11ty / eleventy-base-blog

A starter repository for a blog web site using the Eleventy static site generator.
https://eleventy-base-blog.netlify.app/
MIT License
1.21k stars 619 forks source link

Confused about tags with spaces or and capital letters #89

Closed sabelapaulo closed 2 years ago

sabelapaulo commented 3 years ago

Let's say I've some front matter like this:


tags:

Now what I'm hoping for is http://example.com/tags/tag-with-spaces and http://example.com/tags/capital. In other words the spaces get converted to hyphens and the capital letters get converted to lowercase.

But instead I get http://example.com/tags/tag%20with%20spaces and http://example.com/Capital

The result is as desired however with the title being set to title: Tagged “{{ tag }}” in the frontmatter. I want to keep the spaces and and capital letters in the title but NOT in the permalink. Is there any way to do this?

nhoizey commented 3 years ago

There is an ongoing discussion about changing this behavior: https://github.com/11ty/eleventy/issues/278

zachleat commented 2 years ago

Tags are case sensitive by default, and using the slug or slugify filters are what you want to convert the tag strings into URL friendly permalink values.

slugify: https://www.11ty.dev/docs/filters/slugify/

Some discussion about tag normalization is happening at https://github.com/11ty/eleventy/issues/2462 if you’d like to follow along further!