Let’s say I have three sections:
- News
- Stories
- Profiles
I want to aggregate this content into a geographic context that makes sense for my users (U.S. States) so I create a section for States, too. On each state page I show the five most recent pieces of content from each of the other sections with a shortcode:
Alabama page (/states/alabama.md)
Recent News
{{< section-content-by-tag tag=“Alabama” section=“news” >}}
Recent Articles
{{< section-content-by-tag tag=“Alabama” section=“articles” >}}
Species in Alabama
{{< section-content-by-tag tag=“Alabama” section=“wildlife” >}}
Question
Older content is pushed off of this page once five newer pieces have been written. I want to create an archive for that content.
How would I go about creating a page that paginates all articles
tagged with Alabama
(skipping, or after
the five showed on the Alabama section page), a page that paginates all news
tagged with Alabama
, and a page with all profiles
tagged with Alabama
?
According to the docs only the homepage, section templates, and taxonomy templates support pagination. Is what I’m trying to accomplish even possible as of yet? Do I need to reorganize my content?
This comment from Bep may or may not be relevant here:
Remember that this is a static site generator, so all the paginator pages are static, so for the node pages (home page, taxonomy page) there is 0 or 1 paginator (not 2 or 3 … where should we put those pages?).
I can kinda get half way there through taxonomies
by paginating all content tagged with Alabama
and grouping by section, but the user would have to page through 10 pages before they hit profiles
content.
taxonomy/tag.html
{{ $paginator := .Paginate .Data.Pages }}
{{ range $paginator.Pages.GroupBy "Section" }}
<h2>{{ title .Key }}</h2>
{{ range .Pages }}
{{ .Render "summary"}}
{{ end }}
{{ end }}
{{ partial "pagination.html" . }}