estruyf / vscode-front-matter

Front Matter is a CMS running straight in Visual Studio Code. Can be used with static site generators like Hugo, Jekyll, Hexo, NextJs, Gatsby, and many more...
https://frontmatter.codes
MIT License
1.85k stars 69 forks source link

Issue: slug placeholder not working if there is no title field #830

Open estruyf opened 5 days ago

estruyf commented 5 days ago

The issue mentioned on Discord: https://discord.com/channels/992409023607476224/1255903840352604263

Hello. If I use the placeholder {{slug}} for the default value of a field, it doesn't work if the title field is not defined beforehand in the type. Is there a way to make it work without adding the title field?

On the other hand, can the "title" field be renamed to something else? I find it too opinionated, forcing you to use that field in your collections.

I've tested it and there's an issue: it only works if the "title" field exists in the frontmatter. If I set "frontMatter.taxonomy.seoTitleField" to another field, it uses it correctly. However, if the frontmatter doesn't contain a "title" field, it can't read it and doesn't display anything in the SEO section.

image

image

image

estruyf commented 5 days ago

Fixes implemented: