Simple and good management of special (ie accented) characters in taxonomy slug and URLs associated with taxonomies

Copy/paste from a great summary written by user "Guillermo" on TenderApp, February 14, 2014.

Here's what I have in my local installation, a website in Spanish:

Some articles have the category: "Gestión para el autónomo". The perfect situation would be to have the URL "/categories/gestion-para-el-autonomo" with all the articles which have that tag. This is exactly the way WordPress does.

But it's not working in Statamic:

I have the default installation of Statamic with the default theme "acadia" active. In the right sidebar, the categories listing shows that category name as "gestión para el autónomo" (removing the uppercase).

  • With "_taxonomy_slugify" set to "false":

The sidebar link to the category shows the URL "gestión para el autónomo". Clicking on that link, the template shows all the articles which have the category but the URL in the browser is translated to a very UGLY one: "gestión%20para%20el%20autónomo" (Emmanuel's note: in 1.8.4, this is still true and _taxonomy_slugify set to True won't work)

  • With "_taxonomy_slugify" set to "true":

Sidebar link URL is much better: "gestión-para-el-autónomo" Clicking on the link, the template, it shows all the articles which have that category keeping the URL in the browser "gestión-para-el-autónomo" BUT the category name shown by "{{ taxonomy_name|title }}" is "gestión-para-el-autónomo" (Emmanuel's note: it is not acceptable to get special characters in the url)

  • So... what we want is really simple now:

The URL generated for a taxonomy should be slugified. On my example should be "gestion-para-el-autonomo". When accessing that URL, show all the articles which have that category, keeping the category name as it is, with its accents and spaces.

>>>>>>> Unanswered <<<<<<<
3 Replies