Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
estruyf opened this issue Jun 9, 2022 · 3 comments
Labels
enhancement New feature or request Project: v8.0.0

Comments

@estruyf
Copy link
Owner

estruyf commented Jun 9, 2022

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.

@estruyf estruyf added the enhancement New feature or request label Jun 9, 2022
@estruyf
Copy link
Owner Author

estruyf commented Jun 10, 2022

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
    }
  ]
}

@anakinsleftleg
Copy link

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.

@estruyf
Copy link
Owner Author

estruyf commented Jun 13, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Project: v8.0.0
Projects
None yet
Development

No branches or pull requests

2 participants