<p>This post helped me with my issue with a different approach (except of using the kebab filter the slug of the tag is used for the route)</p>

<p><a href="https://craftcms.stackexchange.com/questions/17026/use-of-tag-slug-instead-of-tag-title-in-a-custom-route">Use of tag.slug instead of tag.title in a custom route</a></p>

<p>as I think that makes lot more sense then using the title, maybe it would be a good idea to update the article in the support section of the craftcms website.</p>

CC BY-SA 3.0
2017-10-01T14:53:58.520Z
+100 on updating the article in the support section. I think that article predates the existance of `tag.slug`
Marion Newlevant
CC BY-SA 3.0
2017-08-01T06:51:16.547Z
2017-08-01T06:51:16.547Z
Jan
<p>I use the code "Link to the Tag URLs" from the following article:
<a href="https://craftcms.com/support/tag-urls" rel="nofollow noreferrer">https://craftcms.com/support/tag-urls</a></p>

<pre><code>{% if entry.tags | length %}
&lt;h3&gt;This entry is tagged with:&lt;/h3&gt;

&lt;ul&gt;
    {% for tag in entry.tags %}
        &lt;li&gt;&lt;a href="{{ siteUrl }}tags/{{ tag.title | url_encode }}"&gt;{{ tag.title }}&lt;/a&gt;&lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;{% endif %}
</code></pre>

<p>One thing is that the "url_encode" doesnt really apply as if I expected. The URL looks like this:
<a href="http://domain.dev/tags/My%20Tag%20Name" rel="nofollow noreferrer">http://domain.dev/tags/My%20Tag%20Name</a></p>

<p>But when I click on it, there are still spaces in the address line. </p>

<p>So my question is: is that ok like this?</p>

<p>I was also thinking about using the kebab filter. There I receive this url:
<a href="http://domain.dev/tags/my-tag-name" rel="nofollow noreferrer">http://domain.dev/tags/my-tag-name</a></p>

<p>which looks prettier. But I now I get an error with the routing when I want fetch the tag:</p>

<pre><code>{% set tag = craft.tags.title(tag).first() %}
</code></pre>

CC BY-SA 3.0
2017-07-24T18:01:07.717Z
Possible dupes? https://craftcms.stackexchange.com/questions/10344/how-can-i-use-tag-slugs-in-urls and https://craftcms.stackexchange.com/questions/18277/best-method-to-handle-20-in-tag-urls-with-multiple-words and https://craftcms.stackexchange.com/questions/6581/problem-with-accents-in-tags-url ?
Brad Bell
CC BY-SA 3.0
2017-07-26T15:34:40.117Z
Yes, definitly. But another post helped me: https://craftcms.stackexchange.com/questions/17026/use-of-tag-slug-instead-of-tag-title-in-a-custom-route Thanks anyway Brad!
Jan
CC BY-SA 3.0
2017-07-26T18:11:02.770Z
Awesome... would you mind adding what worked for you as an official answer?
Brad Bell
CC BY-SA 3.0
2017-07-31T00:45:02.113Z
If you look towards the bottom of this page, you should see a "Your Answer" section followed by a big WYSIWIG editor where you can add an answer.
Brad Bell
CC BY-SA 3.0
2017-07-31T10:09:19.677Z
yes, I know that but stackexchange always marks my entry as "trivial answer" and moves it here in the comment section.
Jan
CC BY-SA 3.0
2017-07-31T23:16:22.610Z
Oh... I think maybe they're looking for a certain answer length? i.e. over X characters long or something?
Brad Bell
<routes><tags>
How to get a proper tag Url
# How to get a proper tag Url

(Asked by: username_0 on 2017-07-24)

I use the code "Link to the Tag URLs" from the following article:
https://craftcms.com/support/tag-urls
{% if entry.tags | length %}
This entry is tagged with:


    {% for tag in entry.tags %}
        {{ tag.title }}
    {% endfor %}
{% endif %}

One thing is that the "url_encode" doesnt really apply as if I expected. The URL looks like this:
http://domain.dev/tags/My%20Tag%20Name
But when I click on it, there are still spaces in the address line. 
So my question is: is that ok like this?
I was also thinking about using the kebab filter. There I receive this url:
http://domain.dev/tags/my-tag-name
which looks prettier. But I now I get an error with the routing when I want fetch the tag:
{% set tag = craft.tags.title(tag).first() %}

**Tags:** routes, tags

> **Comments:**
> **username_1**: Possible dupes? https://craftcms.stackexchange.com/questions/10344/how-can-i-use-tag-slugs-in-urls and https://craftcms.stackexchange.com/questions/18277/best-method-to-handle-20-in-tag-urls-with-multiple-words and https://craftcms.stackexchange.com/questions/6581/problem-with-accents-in-tags-url ?  
> **username_0**: Yes, definitly. But another post helped me: https://craftcms.stackexchange.com/questions/17026/use-of-tag-slug-instead-of-tag-title-in-a-custom-route Thanks anyway Brad!  
> **username_1**: Awesome... would you mind adding what worked for you as an official answer?  
> **username_1**: If you look towards the bottom of this page, you should see a "Your Answer" section followed by a big WYSIWIG editor where you can add an answer.  
> **username_0**: yes, I know that but stackexchange always marks my entry as "trivial answer" and moves it here in the comment section.  
> **username_1**: Oh... I think maybe they're looking for a certain answer length? i.e. over X characters long or something?  

---

## 1 answers

### Answer by username_0 on 2017-08-01. Score: 1

This post helped me with my issue with a different approach (except of using the kebab filter the slug of the tag is used for the route)

[Use of tag.slug instead of tag.title in a custom route](https://craftcms.stackexchange.com/questions/17026/use-of-tag-slug-instead-of-tag-title-in-a-custom-route)

as I think that makes lot more sense then using the title, maybe it would be a good idea to update the article in the support section of the craftcms website.

> **Comments:**
> **username_2**: +100 on updating the article in the support section. I think that article predates the existance of `tag.slug`  

---

