11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
17.13k stars 495 forks source link

[Feature Request] i18n plugin: new url filter able to deal simultaneously with pathPrefix & defaultLanguage #2532

Closed TigersWay closed 2 years ago

TigersWay commented 2 years ago

Is your feature request related to a problem? Please describe. Trying to use the new i18n plugin, I believe we still have to deal with the common trouble url/permalink.

Describe the solution you'd like I would love to see a new url filter superseding the normal one, and able to deal simultaneously with both pathPrefix and defaultLanguage. ex: with pathPrefix=/subdir & defaultLanguage=en

That new filter would be a good help for users starting with i18n able websites.

Describe alternatives you've considered Have done my own filter of course, but both parameters exist only - with tricks as of today - in .eleventy.js and so are not easy to deal with.

zachleat commented 2 years ago

Personally, I’d love to retire the url filter altogether and implement it using posthtml-urls instead! (We already use this in the RSS plugin)

Then we wouldn’t have to litter url filters all over the template code and remember to use it everywhere—it would just solve the problem much nicer.

zachleat commented 2 years ago

The more I think about it, the more I like this simplification. I’ve filed #2535 for this new feature, please follow along over there!