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

fix: accept simple quotes in permalinks as even Windows accepts it #138

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

dpobel
Copy link
Contributor

@dpobel dpobel commented Dec 30, 2023

What has changed?

Make sure it's possible to have a permalink with simple quotes ('). Even Windows is fine with it 😁

Long story short: I'm upgrading @metasmith/permalinks to 3.0.0 and with a bit of configuration everything works fine except a permalink with a ' (https://damien.pobel.fr/tag/lecteur-d'%C3%A9cran/) that previously worked fine.

Level of change

  • Bug fix
  • Added functionality

unsure if it's a bug or a feature to be honest but given the comment in the source about Windows not accepting a quote, I tend to think it's a bug fix. (note: the comment suggests it's possible to override the regexp, but I haven't found a way to do it)


For Added functionality and API changes make sure the documentation has been updated accordingly.

@webketje
Copy link
Member

webketje commented Jan 3, 2024

I remember I documented this in a commit body: b30d875. In your case specifying { slug: { remove: /regex-without-simple-quote/ }} as options would solve the issue (you could use the one defined as defaultSlugifyRemoveChars). Can you confirm?

My reasoning is that a FR user with a file at /tag/lecteur-d'écran probably wants it to end up at /tag/lecteur-d-écran, but I think this is not what happens with 3.0.0 (rather, /tag/lecteur-decran), so I need to go back and test. Any change to the single quote would also need to be a change for the double quote to be consistent. IMO single & double quotes should continue to be stripped/replaced by default, but it should be possible (and easy) to allow them anyway.

@webketje webketje merged commit a29d897 into metalsmith:main Jan 10, 2024
5 checks passed
@dpobel
Copy link
Contributor Author

dpobel commented Jan 17, 2024

Sorry for the late reply @webketje I've been quite busy these days. I see you merged that and that's cool. I guess you figured it already but { slug: { remove: /regex-without-simple-quote/ }} was not working, I've not dug that much into the code, but I think the check was done anyway.

Also, given I want to keep a lots of characters that are removed by default, I need to pass a custom slug function and AFAICT it's not possible to pass both the remove RegExp and a custom slug function.

Anyway, I've just tested with the last commit and it's working fine me now. Is a 3.0.1 planned soon ?

@dpobel dpobel deleted the accept-simple-quotes branch January 17, 2024 17:39
@webketje
Copy link
Member

https://github.com/metalsmith/permalinks/releases/tag/v3.0.1

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

Successfully merging this pull request may close these issues.

2 participants