I’m wondering if it’s possible to force Hugo to generate intermediary index.html files for every part of my /posts/:year/:month/:slug for posts?
Like my ultimate goal is to either redirect the user to my archives page, or serve the archives from something like /posts/2018/index.html, /posts/2018/April/index.html, etc.
Thanks for your response. I’ve realized I was asking the wrong question and have figured out my issue, but do have a related question to my original issue.
Based on my config of: /posts/:year/:slug
and given the posts layout of:
The question is, how can I turn the generated output of 2019/index.html to be a paginator for only posts that live beneath it (ie content within the 2019 directory)? For example /posts/ should be a paginator for all posts (which it correctly is), but /posts/2019/ should be a paginator for only 2019.
As of right now that 2019/_index.md is using the layouts/posts/list.html template, but I’d like it to be context aware we’re in 2019.
Am not sure on this one. My guess would be in your list template to filter down the pages you select to only those of the given year. But since you’ll have multiple sections/years, you’ll need a way to dyamically get the year. Hopefully others on here will be able to help you.
In the meantime, share your code, and you’ll be more likely to get help.
You can search the forums, a lot of attempts and neat template tricks to get most of the way, but currently we don’t create blog-style date-based paginated archive pages.