-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
slug fix #1012
slug fix #1012
Conversation
Deploy preview for netlify-cms-www ready! Built with commit 081ef6b |
Deploy preview for cms-demo ready! Built with commit 081ef6b |
6518df7 is subject for discussion but IMHO files, urls should NOT contain unicode chars. |
@vencax Can you explain your reasoning as to why Unicode characters should not be allowed by the CMS? It seems trivial to do the processing in your SSG instead. Our reasoning for allowing Unicode chars is in #640:
EDIT: As a matter of specification, URIs with Unicode characters (known as IRIs) are valid HTML5. See https://www.w3.org/TR/html52/infrastructure.html#infrastructure-urls and it's linked articles. |
ping @vencax. Can you update us on why you think Unicode chars need to be stripped out of URLs/filenames? I think it's just as easy to process URL's in your site generator instead of the CMS, but if you think otherwise, please let us know! |
As an site admin I want nice urls that does not contain any special chars. I want as well nice filenames in repository -> in media URLs. I use bare GH pages. I use them with NetlifyCMS and I want it to allow BFUs to manage the site without any knowledge of entire sitegenerating process. |
Exactly, this has to be a matter of opinion. I don't have any problem discussing this more with the other maintainers. Personally, I don't have any problem with this being an option, I just think it's more practical to have static site generators do it. You have outlined a case where it isn't as practical. I think the easiest way would be to allow users to add their own slugification plugins/functions to the CMS, instead of us creating a single default for everyone (either with or without diacritics). Thoughts? |
src/lib/slug.js
Outdated
@@ -0,0 +1,10 @@ | |||
import slug from 'slug'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, if it was a plugin, you could use slug
if you wanted, no problem there!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A check could easily be set here for this.implementation.slugFormatter
existing on the backend and use it instead. This would allow for a customized slug method. Although it assumes it would have to be a registered backend which is where we are heading soon anyway.
What do you mean with registered backend? |
@vencax he means you can register a custom backend via The serializeWidgetValues API is an undocumented config options specifically for handling complex values in an intermediary format during editing for performance. It was created for the markdown widget, but currently isn't in use. I know it technically works for this case, but we wouldn't want to use it for that. If you're not using a static site generator, do you at least have a script where you can strip characters out of filenames at build time? |
I have only git repo and nothing else. When something change in the repo (gh-pages branch), gh pages jekyll is rebuild. Principle of GH pages ... |
Closing in favor of #1135, should be merged shortly. |
This fix originally fixed issue with unicode chars in slug (#414).
I hope i won't need to fix that anymore :)