I’d like to create special collection pages that do the following.
Let me create a custom section of content at the top. (think: intro, description, maybe some links or disclaimers)
Automated collection of posts with a certain tag. Preferably with options for me on how to display (alphabetical, chronoligical, reverse-chronological, etc.)
Is this something that’s pretty easy to do, maybe with some light Hugo magic?
You can use range even though it’s a “single” to get all pages. “Single” doesn’t mean it can only access a single page. The example above uses a single template.
From the following Documentation page over here, but because my page is a ‘single’ page I’m getting an error which says ‘Pages’ is undefined / null reference error as there’s nothing to paginate.
Do you know how I can create a custom ‘list’ page, that only shows some specific categories, instead of a custom ‘single’ page?
Or is this possible with a ‘single’ page and I need a different way to access the variables?
But to do what you want (highlight a specific post first it seems like?) I would do something… completely different and far simpler.
I’d do something like
{{ $pinned := where .Site.Pages "Params.categories" "pinned" }}
{{ range last 1 $pinned.Pages.ByDate }}
...
{{ end }}
And just put that above your existing list of posts in your index.
That will first list the most recent post with the category pinned, then do all your other posts like normal.
For complex theming adjustments, I highly recommend using the export – theme and Markdown option-- and building locally with Hugo. The fact that you use GitHub suggests you’re sophisticated enough to do that-- the errors will be more informative and way easier/faster to locally debug just using hugo server which will quickly (sub 2 seconds) auto rebuild on save and show you messages as well as autorefresh your browser.