Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

č not transformed into c in path slug #323

Open
cloetensbrecht opened this issue Aug 31, 2023 · 2 comments
Open

č not transformed into c in path slug #323

cloetensbrecht opened this issue Aug 31, 2023 · 2 comments

Comments

@cloetensbrecht
Copy link
Contributor

When entering a page title like Vančura, the path is not slugged correct: vančura.
I should expect that č would be transformed into c.

@benmerckx
Copy link
Member

Since every modern browser, Javascript runtime and filesytem supports unicode in their URIs/filenames I think it's fair to accept this is as a correct path

We could add an option to try to substitute certain characters using a function like (https://github.com/sindresorhus/transliterate) but it still would not support languages with another script such as Chinese or Japanese

@cloetensbrecht
Copy link
Contributor Author

In this case we should find a solution for finding the matching route when retreiving it through the cms.maybeGet function. Because it's resulting a notfound:

const data = await cms.maybeGet(MySchema({path: slug}))

This snippet is resulting in a notfound when the slug contains č.

To fix this we can decode the received slug:

const data = await cms.maybeGet(MySchema({path: decodeURI(slug)}))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants