Skip to content

How to align the default slug generation behavior with astro? #922

Open
@yinhx3

Description

@yinhx3

Is your feature request related to a problem? Please describe.
Refer Astro Content Loader API | Docs, astro use github-slugger to generate a slug with kebab-cased words.

Setting frontMatter.taxonomy.slugTemplate has these options:

  • When using the {{title}} placeholder in the slug template it will be automatically converted to lowercase and spaces will be replaced with hyphens.
  • To have a SEO friendly URL, you can use the {{seoTitle}} placeholder instead.
  • If the setting is not defined, the page name will be used as the slug.

I don't use slug property in file, just let astro generate it by file name. But there is no an option to tell front matter CMS to use a slugged file name to open the preview.

It is not a big problem, since files created by front matter panel has a slugged file name. But when user create file manually, the file name may have space, causes preview path mismatch.

Describe the solution you'd like
New setting to set file name to slug strategy. Or new placeholder like {{fileName}}, {{sluggedFileName}} for frontMatter.taxonomy.slugTemplate. Or match the slug strategy automatically with the framework setting

Metadata

Metadata

Assignees

No one assigned

    Labels

    In BETAThe current task is available for testing in the BETA version.enhancementNew feature or requestv10.8.0Project: v10.8.0v10.9.0

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions