<p>I try to avoid using tag titles in urls. Unlike categories, tags don't have a url-friendly slug, and the tag title itself can contain all manner of punctuation. So you have to clean up the tag somehow (<a href="https://github.com/boboldehampsink/slugify/" rel="nofollow">slugify</a> e.g.), and later you have to try to reconstruct the tag from the slugified value, which isn't always even possible (different tag titles can slugify to the same value). What I use instead is the tag id, which is nicely unambiguous and url-friendly.</p>

<p>Your route to define the url would still look like:</p>

<pre><code>actualites/tag/[tag] -&gt; whatever_template
</code></pre>

<p>And you would retrieve the actual tag like this:</p>

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

CC BY-SA 3.0
2015-01-15T06:59:30.253Z
2015-01-15T06:59:30.253Z
Marion Newlevant
<p>There is a <a href="http://buildwithcraft.com/docs/config-settings#limitAutoSlugsToAscii" rel="noreferrer">general config setting</a> for it:</p>

<pre><code>'limitAutoSlugsToAscii' =&gt; true,
</code></pre>

<blockquote>
  <p>Limits automatically-generated slugs to ASCII characters. When there
  is an obvious ASCII version of a character (e.g. ñ → n), it will be
  used. Other characters will be removed.</p>
</blockquote>

CC BY-SA 3.0
2015-01-14T14:35:26.493Z
2015-01-14T14:41:48.860Z
2015-01-14T14:41:48.860Z
KSPR
<p>I suspect it's something else going on in your code.</p>

<p>I just did a simple test on a fresh install of Craft after adding one tag called <code>Traçage électrique</code> to the default entry and tag field that was created:</p>

<pre><code>{% set tag = craft.tags.name('Traçage électrique').first() %}

Tag Length = {{ tag|length }}&lt;br /&gt;

{% set entries = craft.entries.section('news').relatedTo().limit(5).find() %}

Entry Length = {{ entries|length }}
</code></pre>

<p>And it appears to be working fine:</p>

<pre><code>Tag Length = 1
Entry Length = 1
</code></pre>

CC BY-SA 3.0
2015-01-14T20:33:56.560Z
2015-01-14T20:33:56.560Z
Brad Bell
<p>I did some digging in the database, following Brad advices.
First, the code was ok. Here the one I used.</p>

<pre><code>{% set current_tag = craft.tags.name(tag).first() %}
{% set newsCriteria = craft.entries.section('news').relatedTo(current_tag).limit(5) %}
</code></pre>

<p>I find out that I had multiple tags names the same in the table "craft_content".
I assume that the last one was associated to the news, and the first one was the one queried by the "name(tag).first()" call. And so there was no news associated with this tag.</p>

<p>I deleted all the tags in the craft_content table, and re-created them in the backoffice.
Now it works perfectly.</p>

<p>thanks for all your help</p>

<p>Nicolas</p>

CC BY-SA 3.0
2015-01-16T10:55:08.520Z
2015-01-16T10:55:08.520Z
Nicolas Binet
<p>I'm having a problem getting entries related to a tag with accentuated characters.
Here is what the URL looks like : fr.craft.dev/actualites/tag/Traçage%20électrique</p>

<p>The same page work fine with a tag without accents.</p>

<p>Is there anything special to do to fix this on my side ?
Or is-it a problem with craft ?
Here is my code :</p>

<pre><code>{% set tag = craft.tags.name(tag).first() %}
{% set newsCriteria = craft.entries.section('news').relatedTo(tag).limit(5) %}
</code></pre>

<p>Thanks for your help.</p>

<p>Nicolas</p>

<tags>
Problem with accents in tags & URL
# Problem with accents in tags & URL

(Asked by: username_0 on 2015-01-14)

I'm having a problem getting entries related to a tag with accentuated characters.
Here is what the URL looks like : fr.craft.dev/actualites/tag/Traçage%20électrique
The same page work fine with a tag without accents.
Is there anything special to do to fix this on my side ?
Or is-it a problem with craft ?
Here is my code :
{% set tag = craft.tags.name(tag).first() %}
{% set newsCriteria = craft.entries.section('news').relatedTo(tag).limit(5) %}

Thanks for your help.
Nicolas

**Tags:** tags


---

## 4 answers

### Answer by username_1 on 2015-01-15. Score: 2 | Accepted answer

I try to avoid using tag titles in urls. Unlike categories, tags don't have a url-friendly slug, and the tag title itself can contain all manner of punctuation. So you have to clean up the tag somehow (slugify e.g.), and later you have to try to reconstruct the tag from the slugified value, which isn't always even possible (different tag titles can slugify to the same value). What I use instead is the tag id, which is nicely unambiguous and url-friendly.
Your route to define the url would still look like:
actualites/tag/[tag] -> whatever_template

And you would retrieve the actual tag like this:
{% set tag = craft.tags.id(tag).first() %}


---

### Answer by username_2 on 2015-01-14. Score: 5

There is a general config setting for it:
'limitAutoSlugsToAscii' => true,


Limits automatically-generated slugs to ASCII characters. When there
  is an obvious ASCII version of a character (e.g. ñ → n), it will be
  used. Other characters will be removed.


---

### Answer by username_3 on 2015-01-14. Score: 1

I suspect it's something else going on in your code.
I just did a simple test on a fresh install of Craft after adding one tag called Traçage électrique to the default entry and tag field that was created:
{% set tag = craft.tags.name('Traçage électrique').first() %}

Tag Length = {{ tag|length }}

{% set entries = craft.entries.section('news').relatedTo().limit(5).find() %}

Entry Length = {{ entries|length }}

And it appears to be working fine:
Tag Length = 1
Entry Length = 1


---

### Answer by username_0 on 2015-01-16. Score: 0

I did some digging in the database, following Brad advices.
First, the code was ok. Here the one I used.
{% set current_tag = craft.tags.name(tag).first() %}
{% set newsCriteria = craft.entries.section('news').relatedTo(current_tag).limit(5) %}

I find out that I had multiple tags names the same in the table "craft_content".
I assume that the last one was associated to the news, and the first one was the one queried by the "name(tag).first()" call. And so there was no news associated with this tag.
I deleted all the tags in the craft_content table, and re-created them in the backoffice.
Now it works perfectly.
thanks for all your help
Nicolas


---

