I’m trying to figure out how to create a list view for nested content when the “type” has been changed and I don’t see a section in the documentation about it.
Let’s say I have a content section that’s structured like this…
content
However I can’t seem to figure out how to generate the list.html page for “type” that would create a list view of all the markdown files within the “type” folder in “content”. ex. mywebsite.com/section/type
What’s weird is when I go to mywebsite.com/section/type, I don’t get a 404 but it doesn’t load the template I’ve created.
I’m sorry if this question has an obvious answer in the docs but I can’t find it, I would love to figure this out ha.
@ajhogue6 I think that what’s making this difficult for me to answer is that type and section have specific definitions in Hugo. If I’m reading your questions correctly, though, I think what you’re looking for is a list view at the following location:
layouts/section/type.html, although I haven’t tested nested content directories as you currently have your source organized. There is also this section in the current docs:
@rdwatters Hey sorry to confuse with the terminology I was using. Let me try to explain a little better. What I did was give each markdown file within the audi/ folder, a type of audi. In that way, I am trying to basically make a sub-section of audi within cars and I considered that a type whereas, cars would be a section.
what I want to be able to do in my layouts folder is be able to go to mywebsite.com/cars/audi and see a view that has all the data from the markdown files within the folder “audi/”.
from this layouts setup I can go to mywebsite.com/cars —> and see everything within that folder, However, I can’t go to mywebsite.com/cars/audi and get anything to actually render. I don’t get a 404 message, the only tag that comes in is a <pre> tag.
hopefully that makes more sense? I tried making another layout in layouts/section/audi.html but that didn’t work, again nothing loads and i just get a <pre> tag when I go to mywebsite.com/cars/audi
Hmmm. If you want to make a list of content that isn’t necessarily a section and is defined by a parameter/attribute that you define in the front matter of individual content files, I would suggest a taxonomy.
You can define in this in your config.toml file:
[taxonomies]
car = "cars"
Then in front matter, just add the make of the car to an array; for example in yaml:
---
cars: [audi]
---
You can then create a list view for yoursite.com/cars/audi that will build according to the templating you create at _default/taxonomy.html.
@rdwatters oh niceeee yea that’s exactly what I’m trying to do and sorry to draw this out but I got one more question (if you’d be so kind).
Where would I create this list view? If I were to go the route of making my template in a taxonomies/ folder (ex. taxonomies/audi (or would it be taxonomies/car?)
So far I’ve created a template in taxonomies/audi but I’m not sure about the list view do I just create another folder called audi and then a list.html file within?
Sorry can’t quite figure it out, thank you for the help though!