I have a partial file, like the following:
File: pagination.html
<div class="pagination">
{{ if .NextInSection }}
<a class="btn next" href="{{.NextInSection.Permalink}}">Next</a>
{{ end }}
{{ if .PrevInSection }}
<a class="btn previous" href="{{.PrevInSection.Permalink}}">Prev</a>
{{ end }}
</div>
In the post’s single.html
file, I wrote the following:
{{ partial "pagination.html" . }}
Then the build come up with an error saying:
NextInSection
is not a field of struct type *hugolib.Node
However, the pagination works on the site even if there are errors …
If I replace the partial part in single.html
with pagination.html’s content. It works.
When calling partial file insingle.html
, I just passed the current context to it. Normally, pagination.html
should take the outer context and find the .NextInSection variable.
Maybe I am missing something here. Any ideas ?