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

Replace single quote with sanitize_replacement character in slugs #7147

Open
nhoizey opened this issue Mar 16, 2024 · 0 comments
Open

Replace single quote with sanitize_replacement character in slugs #7147

nhoizey opened this issue Mar 16, 2024 · 0 comments
Labels
area: slugs type: feature code contributing to the implementation of a feature and/or user facing functionality

Comments

@nhoizey
Copy link

nhoizey commented Mar 16, 2024

Is your feature request related to a problem? Please describe.

Current slug feature removes single quotes (used as apostrophes) without replacing them with the sanitize_replacement character.

For example I have a French content titled Test d'image.

The slug is computed as test-dimage with this configuration:

slug:
  encoding: "ascii"
  clean_accents: true
  sanitize_replacement: "-"

This is wrong, as “dimage” is not a word.

I believe the slug should be test-d-image.

Describe the solution you'd like

I think single quotes (and maybe other characters) should also be replaced with the sanitize_replacement character.

Describe alternatives you've considered

I could use my own slugify function, if it was possible.

Maybe this PR would allow it (I'm not sure):

In other projects, I use @sindresorhus/slugify.

I even developed an extended version for some non latin characters, this is not a trivial topic: https://github.com/nhoizey/eleventy-plugin-pack11ty/blob/main/_11ty/utils/slugify.js

@nhoizey nhoizey added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: slugs type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

No branches or pull requests

2 participants