I’m having a persistent problem accessing the basic front matter params of a taxonomy template page.
We have an /content/taxonomy-name/_index.md
which renders a list of the pages within that taxonomy and the params in the front matter render correctly on it.
We then have a Shortcode that accepts pages to present a prev / next component and is used through the site
{{ $prevPage := .Get "prev_page" }}
{{ $nextPage := .Get "next_page" }}
<div class="prev-next mt-5">
<div class="card-deck">
{{ if $prevPage}}{{ with $.Site.GetPage "page" $prevPage }}
<a class="card card-transparent card-prev" href="{{ .Permalink }}">
<p class="card-direction">Previous article</p>
<h3>{{ .Title }}</h3>
<p>{{ .Description }}</p>
</a>
{{ end }}{{ end }}
{{ if $nextPage}}{{ with $.Site.GetPage "page" $nextPage }}
<a class="card card-transparent card-next" href="{{ .Permalink }}">
<p class="card-direction">Next article</p>
<h3>{{ .Title }}</h3>
<p>{{ .Description }}</p>
</a>
{{ end }}{{ end }}
</div>
</div>
This doesn’t work at all - no data is returned from the taxonomy page front matter
{{< prev-next
prev_page="taxonomy-name/_index.md"
next_page="normal-page/normal-page.md"
>}}
The closest i’ve got to it working is this - the Permalink is returned correctly, but Title is returned as ‘taxonomy-name’ and the description is not returned at all:
{{< prev-next
prev_page="taxonomy-name"
next_page="normal-page/normal-page.md"
>}}
I’ve been trying to figure this problem out on and off for weeks now, and have searched extensively but never quite found anything that seemed like the same issue.
I’ve also updated to the latest version of Hugo and the problem persists.
I have the feeling I’m missing something relatively simple, or I’m failing to understand something conceptually about how taxonomies interact with the .GetPage functionality.
Any help would be greatly appreciated.