I’d like to make a single page listing all the posts of a certain type from all the sections and I’m not sure how because I’m still learning. As I understand it, the list view tend to be per section, not for all sections.
Here’s my setup example for site
I have a few sections to group pages:
/content/apple/ – for pages with type=“fruit”
/content/spinach/ – for pages with type=“vegetable”
/content/orange/ – for pages with type=“fruit”
/content/mango/ – for pages with type=“fruit”
/content/banana/ – for pages with type=“fruit”
/content/carrot/ – for pages with type=“vegetable”
I’d like to a have a page
myexamplesite.com/fruit/ to list all posts of type=“fruit”, weighted by
.Date. How do I go about doing that? Where will the template go?
Addendum: An extension to this issue, I’d also want to make a page (example
myexamplesite.com/foodplant/) to list the sections and their metadata that I have in/data/` Any ideas?
Is there a reason why you do not create all fruit pages in a section named
fruit? For example:
Now you can create a list template to show all fruits at
You can also force URLs and types in front matter. For example:
type will override the content type based on location.
url will create a redirect to the page from that location.
Thanks for the tip. I would have done the same way too, but I inherited this site, and the content was dumped as is from Movable Type. That why I need to do it this way. The example I gave is the simple version of the sections.
I’ve decided to follow your suggestion. A lot easier to maintain the site in the long run. Thanks again!
I certainly understand. Apologies for not thinking about inheriting a site. I had a similar problem when I moved from Octopress to Hugo. Luckily for me I only had to modify 20 posts so I did it by hand.