On my site I have taxonomies authors and translators. For an author I want to display two lists: where he is an author and where he is a translator.
I have a partial, which uses a paginator, displaying the lists in their separate taxonomy list.html today. So I am hoping to be able to list both taxonomies with separate paginators.
I’m thinking that I should be able to list the post where the same term exists in translators by something inserted between the partial and the {{ end }}. there. Making the template something like:
{{ define "main" }}
<h1>{{ .Title }}</h1>
<h2>Author of:</h1>
{{ .Scratch.Set "where" .Data.Pages }}
{{ partial "default.html" . }}
{{ if something }}
{{ with something }}
<h2>Translator of:</h1>
{{ .Scratch.Set "where" .Data.Pages }}
{{ partial "default.html" . }}
{{ end }}
{{ end }}
{{ end }}
But having tried some different something1 and something2, I am starting to doubt this approach.
So, I have tried to figure this out a while now. I don’t see how listing taxonomies help me. The way I understand my problem I first have to figure out the term for the displayed author page, then I want to list all translator pages using that term.
I fail at the first thing there, figuring out the term (the author) for a given author page. And then it is unclear to me how I can range of the pages for that term in a different taxonomy.
{{- $author := .Name -}}
{{ .Scratch.Set "where" .Data.Pages }}
{{ partial "default.html" . }}
{{ range where .Site.Pages "Params.translators" "ne" nil }}
{{- $translator := index (.Params.translators) 0 -}}
{{ if (eq $translator $author) }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
{{ end }}
{{ end }}
Not sure if I could get rid of the if with a smarter where, but anyway, this works for giving me the pages I want.
Next step is less clear for me. My default.html partial takes care of paging the listing. I’m not quite sure how it works, but this is happening in the partial:
Unfortunately I can’t. The list of author summaries is already paginated on the same page. So that second invokation of .Paginate doesn’t do anything. I just get the authors list again.