Issue: front matter is case sensitive #147

Closed
opened 2026-10-05 02:29:24 +02:00 by adam · 6 comments
Owner

After a good amount of troubleshooting I found that the reason that several hundred of my articles were missing from the dashboard and the editing window was that front matter expects all fieldnames to be all lowercase or at least case sensitive.

Hugo doesn't have this requirement and it took me a long time to notice that the initial caps used in some front matter was causing FrontMatter to not parse the articles at all.

I'm not sure if this is a bug or not, but the behavior was surprising especially since it worked differently than Hugo does.

After a good amount of troubleshooting I found that the reason that several hundred of my articles were missing from the dashboard and the editing window was that front matter expects all fieldnames to be all lowercase or at least case sensitive. Hugo doesn't have this requirement and it took me a long time to notice that the initial caps used in some front matter was causing FrontMatter to not parse the articles at all. I'm not sure if this is a bug or not, but the behavior was surprising especially since it worked differently than Hugo does. <!-- github-sync-id:1061816659 -->
adam closed this issue 2026-10-05 02:29:24 +02:00
Author
Owner

It is by design done like this. As the YAML syntax is case-sensitive, and the parser as well.

The best practice for the property keys and values is to write these, is to write them lowercase. That said, we could explore options to let you configure the parser behavior for case sensitivity.

It is by design done like this. As the YAML syntax is case-sensitive, and the parser as well. The best practice for the property keys and values is to write these, is to write them lowercase. That said, we could explore options to let you configure the parser behavior for case sensitivity. <!-- github-comment-id:977604527 -->
Author
Owner

The case sensitivity makes sense to me as the default (or only) behavior, and I'm ok with fixing all of mine to be consistent, but I think the larger issue was that a site that worked fine in Hugo with hundreds of posts, only showed about 25 posts in FrontMatter and there wasn't really an easy way to debug it. It took me a good while to discover that the initial caps were causing the issue. I troubleshooted several prior things I thought it might be before this and even dug around in the source code a bit.

I'm not sure what fields it looks for, but it might be a better experience to identify somewhere that there were articles found that didn't have the right fields (in this case they were just cased incorrectly) but had front matter and were parsed fine.

The case sensitivity makes sense to me as the default (or only) behavior, and I'm ok with fixing all of mine to be consistent, but I think the larger issue was that a site that worked fine in Hugo with hundreds of posts, only showed about 25 posts in FrontMatter and there wasn't really an easy way to debug it. It took me a good while to discover that the initial caps were causing the issue. I troubleshooted several prior things I thought it might be before this and even dug around in the source code a bit. I'm not sure what fields it looks for, but it might be a better experience to identify somewhere that there were articles found that didn't have the right fields (in this case they were just cased incorrectly) but had front matter and were parsed fine. <!-- github-comment-id:978203828 -->
Author
Owner

Two things that come to mind:

  • Diagnostic view, that gives an overview of all project/content details
  • A command that allows you to align all properties (convert to lowercase or camelcase). This way, you do not have to do it manually
Two things that come to mind: - Diagnostic view, that gives an overview of all project/content details - A command that allows you to align all properties (convert to lowercase or camelcase). This way, you do not have to do it manually <!-- github-comment-id:978920816 -->
Author
Owner

I think the diagnostic view would be generally quite useful.
I'm not sure how broadly beneficial the latter one is, but I'd certainly
benefit from it.

I think the diagnostic view would be generally quite useful. I'm not sure how broadly beneficial the latter one is, but I'd certainly benefit from it. <!-- github-comment-id:980123118 -->
Author
Owner

I wrote a quick script to lower initial case my front matter keys, so closing this but agree that a diagnostics feature would be broadly helpful

I wrote a quick script to lower initial case my front matter keys, so closing this but agree that a diagnostics feature would be broadly helpful <!-- github-comment-id:996024842 -->
Author
Owner

That's great news @spf13! If you have other requests, you know where to find me.

That's great news @spf13! If you have other requests, you know where to find me. <!-- github-comment-id:996060090 -->
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#147