Partial file can not use the outer context passed to it

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 }}

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 ?

This means that your partial is being called from a “node template” (home page, list page).

Go’s type system is pretty simple: A Node is embedded in a Page, but a Page can never be a Node. This can be frustrating for people coming from, say, Java, but it makes your problem easier to reason about.

Which must mean that there is something else going on, which means that you should post a reference to a project that shows this funky behaviour.

Thank you for the clarification.
You are right. The partial code is used also in one of the taxonomy template.