Replace current formatSlug()
with a more robust solution for non-english languages
#12715
codeflorist
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The current
formatSlug()
implementation used in the website template as well as the various tests and examples is rather barebones and imho should be replaced with a more robust solution, that takes non-english languages into account.The current implementation is:
This results in non english-characters simply getting dropped. But in german language e.g. one would like the umlaut
ä
to be translated intoae
, andß
be represented asss
.An in my opinion rather good package for this is https://github.com/sindresorhus/slugify.
This is rather easy to implement currently for the website template by adding the package and editing
src\fields\slug\formatSlug.ts
to:But since imho Payload should provide a hassle-free and good out-of-the-box experience also for non-english devs, i would recommend having this in the website template.
Feel free to let me know, if i should provide a pull request for this!
Beta Was this translation helpful? Give feedback.
All reactions