I am new to Hugo and feeling completely obtuse, so please forgive me if this is a simple question but after reading the documentation I have been unable to figure out how to do this so far.
I am trying to list the content of my blog in two different ways. When I to go
/blog I want there to be a list with the summaries of the latest posts. But I also want that page to link to an ‘All blog posts by date’ list that has just the titles of all the posts ordered chronologically.
I assume that I have to use views in order to do this, but how do I get Hugo to generate the second list? The first one appears automatically for
/blog because I have the template in
/layouts/section/blog.html But I have been unable to figure out how to generate the second list so that I can link to it from the first. Thanks for your help!
I have exactly the same issue.
While we wait for the correct and hopefully elegant solution, my cheat was to create a taxonomy called “archives”. I then used an archetype to set every blog post to archives = [“blog”]. Finally I created a layouts/taxonomy/archive.html file. A listing of all posts is now available at mystie.com/archives/blog/.
Nice little trick. That did it. As you say, hopefully in the future there will be a more elegant solution, but this is exactly what I was looking for. Thanks!!
I am trying to do something similar.
I have some posts that I would like to use the frontmatter to generate a kml file to display on a map.
I.e., Iterate all the pages in the post section and extract the relevant info from the frontmatter, process it to the desired format (xml) and put the result in a file with the kml extension.
Of course without disrupting the other listings of the same content.
You could create an xml file to begin with. The solution that comes to mind is to use a bespoke rss feed template. Instead of using the xml for a feed you use the xml for your map file. That would save you from processing the file apart from changing its name…
I would create a taxonomy called map. You can then enter map=[“all”] in the front matter of the posts either manually or using an archetype. You then need to create a custom rss template at layouts/taxonomy/map.rss.xml. The generated file containing your xml will be at public/map/all/index.xml.
The above is just off the top of my head, I did test what would happen if I entered any old xml into the rss template and I doesn’t seem to care.
If you already have a large collection of posts and don’t want to alter the existing front matter then it gets more complicated.