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...

Home Page:https://frontmatter.codes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhancement: False values in boolean fields shouldn't be hidden in Front Matter

marekbrze opened this issue · comments

Is your feature request related to a problem? Please describe.
I have a draft field in my Astro Content Collection. When setting the field to false the whole draft line is hidden from the Front Matter, but the field is required by my Content Collection.

Describe the solution you'd like
The best way would be to have an addition property on the boolean fields to decide if false values should hide the whole line from the front matter.

Describe alternatives you've considered
I could use choices field to have different stages of the drafts, but that's only the one use case for the setting. I have other boolean values that need to be explicitly set.

Hi @marekbrze, on the content type level, you can set the clearEmpty to false (also the default), which should prevent clearing/hiding the line from your front matter.

https://frontmatter.codes/docs/content-creation/content-types#content-type-properties

Oh, I overlooked this setting. Works now! Thanks for the help!