Enhancement: Allow to set the section slug prefix on page folder level in the configuration #278

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

Front Matter allows setting the preview path to be used on the global and content type level. To make it more generic, an extra property would be useful on the frontMatter.content.pageFolders setting.

This way, all content for a specific folder uses the same preview prefix path and allows you to use multiple content types per folder.

Front Matter allows setting the preview path to be used on the global and content type level. To make it more generic, an extra property would be useful on the `frontMatter.content.pageFolders` setting. This way, all content for a specific folder uses the same preview prefix path and allows you to use multiple content types per folder. <!-- github-sync-id:1266383559 -->
adam closed this issue 2026-10-05 02:37:23 +02:00
Author
Owner

On the page folder, you will now be able to set the previewPath property. This property is optional, but allows you to define a section preview path for the whole folder and its related content.

The hierarchy of the preview paths is as follows:

  • Global level
  • Folder level
  • Content type level

Content type overrides what is defined in folder level. Folder level overrides what is defined in global level.

Example configuration looks as follows:

{
  "frontMatter.content.pageFolders": [
    {
      "title": "post",
      "path": "[[workspace]]/content/post",
      "previewPath": "post" // New property
    }
  ]
}
On the page folder, you will now be able to set the `previewPath` property. This property is optional, but allows you to define a section preview path for the whole folder and its related content. The hierarchy of the preview paths is as follows: - Global level - Folder level - Content type level Content type overrides what is defined in folder level. Folder level overrides what is defined in global level. Example configuration looks as follows: ``` { "frontMatter.content.pageFolders": [ { "title": "post", "path": "[[workspace]]/content/post", "previewPath": "post" // New property } ] } ``` <!-- github-comment-id:1152138292 -->
Author
Owner

If you have some configuration for slugs in the hugo config.toml file, are you intending that one would have to match that configuration here in the previewPath? The default of hugo is to put a page at domain.com/section/slug unless you specify in the config.toml that you want something else, like domain.com/slug (which is current (or previous to this change) behavior) or domain.com/YY/MM/DD/slug or whatever other configuration.

Maybe it's not reasonable, but it would be easier if FM read that configuration parameter from the config.toml file and used it. I suppose that might not extend well to other SSGs which is why it would be better that it is part of the FM configuration as you are describing.

If you have some configuration for slugs in the hugo config.toml file, are you intending that one would have to match that configuration here in the previewPath? The default of hugo is to put a page at domain.com/section/slug unless you specify in the config.toml that you want something else, like domain.com/slug (which is current (or previous to this change) behavior) or domain.com/YY/MM/DD/slug or whatever other configuration. Maybe it's not reasonable, but it would be easier if FM read that configuration parameter from the config.toml file and used it. I suppose that might not extend well to other SSGs which is why it would be better that it is part of the FM configuration as you are describing. <!-- github-comment-id:1152447653 -->
Author
Owner

At the moment it will require manually creating the entry in the frontmatter.json file. It could definitely be the next improvement to FM to support the SSGs configuration files.

At the moment it will require manually creating the entry in the `frontmatter.json` file. It could definitely be the next improvement to FM to support the SSGs configuration files. <!-- github-comment-id:1153734076 -->
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#278