Enhancement: make filenames url-friendly - remove diacritics and quotes, keep points. #717

Closed
opened 2026-10-05 03:01:57 +02:00 by adam · 2 comments
Owner

Is your feature request related to a problem? Please describe.
When creating new content and giving a title with diacritics, diacritics are kept in filename. So with hugo, the filename differs from the generated url for the file. This makes it harder to have a preview path that works
Other things : single quotes are kept, but points are erased from filename. It should be the opposite.

So giving a title like :

L'excès à vélo de M. le maire

Makes it a headache to have a working preview path formula, when using Hugo static site generator. seoTitle does not work because it removes L' from the beginning, nor does pathToken, because it is keeping diacritics that hugo is removing when generating url.

Describe the solution you'd like
There is already an option about title to filename translation: https://frontmatter.codes/docs/content-creation/additional-config#preserve-casing-of-file-names
Could there be another option, like "url-friendly-filename"? With this option, diacritics and quotes would be removed, but points would be kept.

Another solution (I prefer) would be to change the default translation from title to filename. As this only affects new files, it should not bother existing projects. There could be an option to preserve diacritics and quotes in filename, but in this case, why not preserve also spaces? I do not see the point to translate them into dash if keeping diacritics and quotes.

Describe alternatives you've considered
Giving a title with no diacritics and no quotes and no points, then correcting it in the frontmatter. This is tedious and not editor-friendly.

**Is your feature request related to a problem? Please describe.** When creating new content and giving a title with diacritics, diacritics are kept in filename. So with hugo, the filename differs from the generated url for the file. This makes it harder to have a preview path that works Other things : single quotes are kept, but points are erased from filename. It should be the opposite. So giving a title like : > L'excès à vélo de M. le maire Makes it a headache to have a working preview path formula, when using Hugo static site generator. `seoTitle` does not work because it removes `L'` from the beginning, nor does `pathToken`, because it is keeping diacritics that hugo is removing when generating url. **Describe the solution you'd like** There is already an option about title to filename translation: https://frontmatter.codes/docs/content-creation/additional-config#preserve-casing-of-file-names Could there be another option, like "url-friendly-filename"? With this option, diacritics and quotes would be removed, but points would be kept. Another solution (I prefer) would be to change the default translation from title to filename. As this only affects new files, it should not bother existing projects. There could be an option to preserve diacritics and quotes in filename, but in this case, why not preserve also spaces? I do not see the point to translate them into dash if keeping diacritics and quotes. **Describe alternatives you've considered** Giving a title with no diacritics and no quotes and no points, then correcting it in the frontmatter. This is tedious and not editor-friendly. <!-- github-sync-id:2852382643 -->
adam closed this issue 2026-10-05 03:01:57 +02:00
Author
Owner

I seemed to have missed the ' single quote in the sanitization. The other characters weren't yet normalized and can be enhanced.

Should the outcome look as follows?

Image

I seemed to have missed the `'` single quote in the sanitization. The other characters weren't yet normalized and can be enhanced. Should the outcome look as follows? ![Image](https://github.com/user-attachments/assets/5b70c05d-2596-44ce-b4b5-bdaaf4eb6aae) <!-- github-comment-id:2658582154 -->
Author
Owner

Version 10.8.0 has been released

Version 10.8.0 has been released <!-- github-comment-id:2687638815 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#717