-
-
Notifications
You must be signed in to change notification settings - Fork 86
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: Link a page folder to a content type #360
Comments
I had this exact same setup thought yesterday. My instinct was to try to set a list of content types per location. One or more options for what kind of content would go into a particular folder. |
@bwklein would you rather have the folder to define which content type to use in it? Or would you define the folder on content type? Both are possible, maybe defining it on content type level is more straightforward. |
I have a site where I have more than one content type in the same folder. |
Just some use cases: Setting the folder link to the content typeWhen the property would be set on the content type, the question to create content should be in the following order:
The second question is based on the property. If present, it will skip it, and create the content, if present, it will create it in the corresponding folder. If you want to use the content type for multiple folders, you should not be setting the property on the content type. That way you have the same experience as to how it is right now. Disadvantage: This might limit the content type. If you have multiple folders with similar content types. You'll have to recreate the content type for each folder or unset the value. Another solution would be to specify multiple folders. Setting the content type for a page folderWhen the property would be set on the page folder level, the order of questions stays the same as they are right now.
In this case, the second question is yet again based on what is defined in the location setting of the previous question. If a content type link is set, the type of content does not need to be defined anymore. When setting it on the folder level, you are still able to use the content type for any folder that is not using the content type link. Disadvantage: Limits one type of content per folder. Although, this limitation is less impactful than setting it on the content type level. We could also allow setting one or more content types on the page folder level. That way, if one is defined, the type of content will not have to be asked. If multiple are present, the second question will be based on these values. Advantage: As every content type already has an ID/name, they are easier to be mapped. |
I really want this, as I have an existing site without explicit type fields because most files are typed via their path. I'd prefer to set one default content type per path, because I have some file types that "float" across this structure. (Though, really, those are more data than post files, in the style of #406) |
Thanks @gerwitz, so you would go for option two. Setting a content type for a page folder. |
Yes, but also allow it to be overridden. Respecting metadata per file would be great, but FYI my ideal would be an ordered list of path matching patterns. E.g. (with pseudo patterns)
Probably this is better handled via page bundles, so feel free to ignore my rambling 😆 |
There will always be the
That would be option one. There are PRO's and CON's for both approaches. At the moment, I'm more in favor of implementing option two but wanted to hear the feedback first. |
Good news, you are now able to give it a try! On the folder defined in the "frontMatter.content.pageFolders": [
{
"title": "blog",
"path": "[[workspace]]/blog",
"filePrefix": "yyyy-MM-dd",
"contentTypes": ["blog"]
},
{
"title": "docs",
"path": "[[workspace]]/docs",
"filePrefix": "",
"contentTypes": ["doc", "page"]
}
] |
@estruyf This works great! One thing I noticed while trying to define a content type mapping - there doesn't seem to be a way around requiring each page in the folder from setting the This can be a problem for Hugo sites, where Thinking through this for a bit, I'm wondering if any of these ideas make sense:
|
@michaeltlombardi, thanks for the feedback. You might be right about the |
I'll file an issue for that as well! Just wanted to be sure there wasn't a way to work around option 2 in this implementation, since it's doing specific mapping for content types. |
This change adds the `toroidal` and `toroidal/admin` content types to the Front Matter configuration so that site maintainers can edit the metadata for those pages in a friendly UI. For member pages and the admin page, this is fully functional. For the webring index, this is limited currently by the implementation of estruyf/vscode-front-matter#362, which introduces `where` logic for the fields but doesn't yet support using that logic to control behavior based on the file name, which would allow us to handle section pages (which are always named `_index.md`) separately from member pages. This change also updates the archetypes for Toroidal to set the `type` to `toroidal` for the index and member pages, ensuring that Front Matter picks up the type correctly for selecting the metadata to display. Due to a limitation outlined in estruyf/vscode-front-matter#360 (see [this comment for more information][01]), we have to use `type` to identify files. This has some implications for Hugo sites which don't _directly_ impact this change. [01]: estruyf/vscode-front-matter#360 (comment)
In some cases, a content type will only be used for a specific page folder. For example: the
blog
content type will be used forposts
page folders.It would be helpful to link the page folder to the content type, that way, while creating new content, Front Matter will not require to ask where the content needs to be created.
The text was updated successfully, but these errors were encountered: