Define path for collection fields, to organize subpages/subpage urls #5769
Labels
area: nested-collections
duplicate
type: feature
code contributing to the implementation of a feature and/or user facing functionality
Is your feature request related to a problem? Please describe.
I am using Netlify CMS and Hugo to create a website for a gallery and want to have a main landing page for each artist, e.g.:
/artists/andy-warhol
But then have links on that page that go to subpages for the artist's biography, exhibition history, etc., e.g.:
/artists/andy-warhol/bio
Unless I am missing something, this is not currently possible with Netlify CMS, because I cannot structure the content files as needed, e.g.,
content/artists/andy-warhol
Describe the solution you'd like
I'd like to be able to define paths within individual fields, which would then output that specific front matter content to its own markdown file. That way I could create the markdown file structure outlined above, so that Hugo will generate the proper url paths.
Something like the below (feature request bolded):
The result of the above would be that the "name", "main_image", and "image_gallery" fields get written to:
artists/{{slug}}/index.md
And the "bio" field gets written to:
artists/{{slug}}/bio.md
With that structure I could create a template that would show the index content at the url:
/artists/andy-warhol
but then replace the image gallery with the bio info at the url:
artists/andy-warhol/bio
Describe alternatives you've considered
Maybe defining the path is the wrong approach, since the "biography" field is already a sub-field of "artists"? It could be some sort of option to give it a custom name, but always within the parent folder defined by the collection configuration?
However, there could be a case where someone wanted to write that data to a totally separate location (e.g.,
path: bio/{{slug}}
to separate the bios into their own section, without having to input them via a separate collection?), in which case being able to define the path would be useful.Additional context
The text was updated successfully, but these errors were encountered: