Answers.Body: <p>You do not have to change your route. Instead modify your template where you are linking the tag.</p>
  
  <p>Instead of using</p>
  
  <pre><code>&lt;a href="{{ siteUrl }}tags/{{ tag.title | url_encode }}"&gt;{{ tag.title }}, &lt;/a&gt;
  </code></pre>
  
  <p>Use</p>
  
  <pre><code>&lt;a href="{{ siteUrl }}tags/{{ tag.slug }}"&gt;{{ tag.title }}, &lt;/a&gt;
  </code></pre>
  
  <p><strong>UPDATED</strong></p>
  
  <p>To clarify the above snippet goes in the template that generates the link to take the the user to your <code>_tag.html</code> template, not in the <code>_tag.html</code> template itself.</p>
  
  <p>Your route should be as below:</p>
  
  <p><a href="https://i.sstatic.net/I5yVA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/I5yVA.png" alt="enter image description here"></a></p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>Above snippet updated to match your example above.</p>
  
  <p><strong>UPDATE 3</strong></p>
  
  <p>As the <code>tag</code> variable made available to your template is now the tag’s slug, make sure to update the code to query for the tag model to use the <code>slug</code> param.</p>
  
  <pre><code>{% set tag = craft.tags.slug(tag).first() %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-28T14:10:01.840Z
Answers.Text: I get a 404 error when I do that
Answers.UserDisplayName: Andrew Staroscik
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-28T14:22:18.320Z
Answers.Text: The above snippet goes in the template that creates the link to your tag not in your _tag.html template
Answers.UserDisplayName: Fyrebase
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-28T14:41:30.423Z
Answers.Text: I've added more code to the question. Sorry for the lack of clarity. For the route, I am not typing (tag token) I am using the token option provided by the edit route dialogue box. If I type /tags/tag_token in the URI I get 404
Answers.UserDisplayName: Andrew Staroscik
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-28T14:48:36.750Z
Answers.Text: `tag_token` is not meant to be typed, it is a representation of the token option you are using. I added an image instead to clarify.
Answers.UserDisplayName: Fyrebase
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-28T14:52:19.797Z
Answers.Text: Yep that is exactly what I have
Answers.UserDisplayName: Andrew Staroscik
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-28T14:59:45.630Z
Answers.Text: Sorry, I'm not sure what else to suggest. I am using `{{ tag.slug }}` with success on multiple sites at present
Answers.UserDisplayName: Fyrebase
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-28T15:03:46.597Z
Answers.Text: Thank you. It does seem like it should work. Hopefully someone else can weigh in.
Answers.UserDisplayName: Andrew Staroscik
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-29T07:30:02.550Z
Answers.Text: @AndrewStaroscik I just updated the answer to add the changes to the criteria model we talked about in Craft Slack.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-29T11:11:03.923Z
Answers.Text: Nice catch @carlcs
Answers.UserDisplayName: Fyrebase
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-28T14:06:58.687Z
Answers.LastActivityDate: 2016-09-29T07:27:16.477Z
Answers.LastEditDate: 2016-09-29T07:27:16.477Z
Answers.UserDisplayName: Fyrebase
Body: <p>I've followed <a href="https://craftcms.com/support/tag-urls" rel="nofollow">this guide</a> for creating a routes to list entries with specific tags. It is working fine except that I have muli-word tags so using the tag token from <code>Settings -&gt; Routes</code> gives me urls like </p>
  
  <p><code>mysite.com/tags/my%20tag%20name</code></p>
  
  <p>I'd like to us the tag.slug instead which should allow me to have urls end in <code>.../my-tag-name</code> instead, but I can't figure out how to do it. </p>
  
  <p>Is there a way to refer to tag.slug in craft/config/routes.php?</p>
  
  <p>If so what should the custom route look like:</p>
  
  <p><code>'tags/what goes here?' =&gt; 'tags/_tag.html',</code></p>
  
  <p><strong>Updated</strong></p>
  
  <p>The template code is: </p>
  
  <pre><code>{% extends "_layout" %}
  
  
  {% block content %}
  
  {% set tag = craft.tags.title(tag).first() %}
  
  {% if not tag %}
      {% exit 404 %}
  {% endif %}
  
  &lt;h2&gt;Entries tagged with “{{ tag.title }}”&lt;/h2&gt;
  
  {% set entries = craft.entries.relatedTo(tag).order('title') %}
  
  {% if entries | length %}
  
          {% for entry in entries %}
              {{ include('./partials/entryListItem.html', {'entry': entry}) }}
          {% endfor %}
  {% else %}
      &lt;p&gt;No entries could be found with that tag.&lt;/p&gt;
  {% endif %}
  
  {% endblock %}
  </code></pre>
  
  <p>and the include points to:</p>
  
  <pre><code>&lt;div class='entry-list-item'&gt;
          &lt;h2&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/h2&gt;
          &lt;p&gt;
            &lt;a href="{{ entry.url }}"&gt;
              &lt;span class="sm-txt"&gt; continue reading&lt;/span&gt;
            &lt;/a&gt;
          &lt;/p&gt;
          {% if entry.tags | length %}
            &lt;p class='sm-txt'&gt;
            {% for tag in entry.tags %}
              &lt;a href="{{ siteUrl }}tags/{{ tag.title | url_encode }}"&gt;{{ tag.title }}, &lt;/a&gt;
            {% endfor %}
            &lt;/p&gt;
          {% endif %}
        &lt;/div&gt;
  </code></pre>
  
  <p>The route is set in the dashboard <code>tags/(tag token)</code> points to tags/_tag.html</p>
  
  <p>If I change the route to <code>tags/(slug token)</code> I get template error: variable tag does not exist.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-09-28T14:11:27.923Z
Comments.Text: Can you provide the code you are using in your template and also what your route looks like?
Comments.UserDisplayName: Fyrebase
Tags: <routes><tags>
Title: Use of tag.slug instead of tag.title in a custom route
ThreadText: # Use of tag.slug instead of tag.title in a custom route
  
  (Asked by: username_0 on 2016-09-28)
  
  I've followed [this guide](https://craftcms.com/support/tag-urls) for creating a routes to list entries with specific tags. It is working fine except that I have muli-word tags so using the tag token from `Settings -> Routes` gives me urls like
  
  `mysite.com/tags/my%20tag%20name`
  
  I'd like to us the tag.slug instead which should allow me to have urls end in `.../my-tag-name` instead, but I can't figure out how to do it.
  
  Is there a way to refer to tag.slug in craft/config/routes.php?
  
  If so what should the custom route look like:
  
  `'tags/what goes here?' => 'tags/_tag.html',`
  
  **Updated**
  
  The template code is:
  
  ```
  {% extends "_layout" %}
  
  {% block content %}
  
  {% set tag = craft.tags.title(tag).first() %}
  
  {% if not tag %}
      {% exit 404 %}
  {% endif %}
  
  <h2>Entries tagged with “{{ tag.title }}”</h2>
  
  {% set entries = craft.entries.relatedTo(tag).order('title') %}
  
  {% if entries | length %}
  
          {% for entry in entries %}
              {{ include('./partials/entryListItem.html', {'entry': entry}) }}
          {% endfor %}
  {% else %}
      <p>No entries could be found with that tag.</p>
  {% endif %}
  
  {% endblock %}
  
  ```
  
  and the include points to:
  
  ```
  <div class='entry-list-item'>
          <h2><a href="{{ entry.url }}">{{ entry.title }}</a></h2>
          <p>
            <a href="{{ entry.url }}">
              <span class="sm-txt"> continue reading</span>
            </a>
          </p>
          {% if entry.tags | length %}
            <p class='sm-txt'>
            {% for tag in entry.tags %}
              <a href="{{ siteUrl }}tags/{{ tag.title | url_encode }}">{{ tag.title }}, </a>
            {% endfor %}
            </p>
          {% endif %}
        </div>
  
  ```
  
  The route is set in the dashboard `tags/(tag token)` points to tags/\_tag.html
  
  If I change the route to `tags/(slug token)` I get template error: variable tag does not exist.
  
  **Tags:** routes, tags
  
  > **Comments:**
  > **username_1**: Can you provide the code you are using in your template and also what your route looks like?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-09-28. Score: 3 | Accepted answer
  
  You do not have to change your route. Instead modify your template where you are linking the tag.
  
  Instead of using
  
  ```
  <a href="{{ siteUrl }}tags/{{ tag.title | url_encode }}">{{ tag.title }}, </a>
  
  ```
  
  Use
  
  ```
  <a href="{{ siteUrl }}tags/{{ tag.slug }}">{{ tag.title }}, </a>
  
  ```
  
  **UPDATED**
  
  To clarify the above snippet goes in the template that generates the link to take the the user to your `_tag.html` template, not in the `_tag.html` template itself.
  
  Your route should be as below:
  
  [![enter image description here](https://i.sstatic.net/I5yVA.png)](https://i.sstatic.net/I5yVA.png)
  
  **UPDATE 2**
  
  Above snippet updated to match your example above.
  
  **UPDATE 3**
  
  As the `tag` variable made available to your template is now the tag’s slug, make sure to update the code to query for the tag model to use the `slug` param.
  
  ```
  {% set tag = craft.tags.slug(tag).first() %}
  
  ```
  
  > **Comments:**
  > **username_0**: I get a 404 error when I do that  
  > **username_1**: The above snippet goes in the template that creates the link to your tag not in your _tag.html template  
  > **username_0**: I've added more code to the question. Sorry for the lack of clarity. For the route, I am not typing (tag token) I am using the token option provided by the edit route dialogue box. If I type /tags/tag_token in the URI I get 404  
  > **username_1**: `tag_token` is not meant to be typed, it is a representation of the token option you are using. I added an image instead to clarify.  
  > **username_0**: Yep that is exactly what I have  
  > **username_1**: Sorry, I'm not sure what else to suggest. I am using `{{ tag.slug }}` with success on multiple sites at present  
  > **username_0**: Thank you. It does seem like it should work. Hopefully someone else can weigh in.  
  > **username_2**: @username_0 I just updated the answer to add the changes to the criteria model we talked about in Craft Slack.  
  > **username_1**: Nice catch @username_2  
  
  ---
  
  