Issue: type is not inferred from pageFolders #504

Closed
opened 2026-10-05 02:50:38 +02:00 by adam · 3 comments
Owner

Describe the bug
We have several content types that are always limited to their own folder. Content type blog does only exist in /content/blog, etc. This is a 1-to-1 relation between folders and content types.

We have defined the content types, and we have also added an entry in pageFolders, which defines the relation between /content/blog and the blog content type.

However, when we open an item from the /content/blog folder, Front Matter CMS still tells us that the fields do not match the default content type.

If we still have to put a type: blog to every blog entry, what is the purpose of the pageFolders setting?

To Reproduce
Steps to reproduce the behavior:

  1. Create two content types with different fields.
  2. Create a 1-to-1 relationship between the content types and subfolders of /content.
  3. Add some content files that match the respective fields, but do not add type: ... to the front matter.
  4. Open one content file. Front Matter does not infer the content type of the file.

Expected behavior
The pageFolders setting should infer the content type of our item.

**Describe the bug** We have several content types that are always limited to their own folder. Content type `blog` does only exist in `/content/blog`, etc. This is a 1-to-1 relation between folders and content types. We have defined the content types, and we have also added an entry in `pageFolders`, which defines the relation between `/content/blog` and the `blog` content type. However, when we open an item from the `/content/blog` folder, Front Matter CMS still tells us that the fields do not match the default content type. If we still have to put a `type: blog` to every blog entry, what is the purpose of the `pageFolders` setting? **To Reproduce** Steps to reproduce the behavior: 1. Create two content types with different fields. 2. Create a 1-to-1 relationship between the content types and subfolders of `/content`. 3. Add some content files that match the respective fields, but do not add `type: ...` to the front matter. 4. Open one content file. Front Matter does not infer the content type of the file. **Expected behavior** The `pageFolders` setting should infer the content type of our item. <!-- github-sync-id:1871891264 -->
adam closed this issue 2026-10-05 02:50:38 +02:00
Author
Owner

Thank you for this suggestion. Initially, this setting was added to make creating content in your page folders easier by not having to select the content-type or limit the content-types.

I understand the problem in your case and have added an extra check for retrieving the content-type from the page folder setting. You can give it a try in the latest beta version.

Thank you for this suggestion. Initially, this setting was added to make creating content in your page folders easier by not having to select the content-type or limit the content-types. I understand the problem in your case and have added an extra check for retrieving the content-type from the page folder setting. You can give it a try in the latest beta version. <!-- github-comment-id:1699046590 -->
Author
Owner

@estruyf wow thanks, that was quick. Gonna try it out.

@estruyf wow thanks, that was quick. Gonna try it out. <!-- github-comment-id:1699172571 -->
Author
Owner

@estruyf works like a charm in the Beta, thanks a lot!

@estruyf works like a charm in the Beta, thanks a lot! <!-- github-comment-id:1699535160 -->
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#504