Skip to content

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

@lamyseba

Description

@lamyseba

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    In BETAThe current task is available for testing in the BETA version.ReleasedThe task has been releasedenhancementNew feature or requestv10.8.0Project: v10.8.0

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions