sveltia / sveltia-cms

Alternative to Netlify/Decap CMS. Fast, lightweight, Git-based headless CMS. Modern UX, first-class i18n support, open source & free. Made with Svelte.
MIT License
862 stars 43 forks source link

Using localized slug with template tags #162

Closed dallyh closed 3 months ago

dallyh commented 3 months ago

Setting a slug field to be localized according to the README works correctly, that is when the pattern mentioned in the readme is uses, everything works fine.

However, when I combine localize with some template tags, the filename is wrong. I don't currently know if this is a bug or intended behavior.

This setting slug: "{{year}}-{{month}}-{{day}}-{{title | localize}}" produces the same filenames for both locales set (cs, en) and that is 2024-06-06-testovaci-post-z-cms.md

image

I tested this a little bit more, and having localize in every tag produces the correct result slug: "{{year | localize}}-{{month | localize}}-{{day | localize}}-{{title | localize}}", however the year etc. are template tags and are not taken from any field, so this could create some confusion.

Maybe just a note in the readme could help, or perhaps localize should work when combined with template tags without adding it inside those tags.

kyoshino commented 3 months ago

Thanks for your thorough testing! Will fix.

kyoshino commented 3 months ago

The fix landed in v0.34.2!