Can't access the .TableOfContents

To give a bit context around the problem:

Inside single.html I render my content as asual. Furthermore I include partial for the sidenav with {{ partial "nav" . }}. Inside this partial I tried to call {{ .TableOfContent }} and {{ $.TableOfContent }} in order to show the toc for the current page. Nothing appeared.

With {{ .Title }} I can access the title of the current page’s title without problems, but this isn’t the case for the {{ .TableOfContent }}.

In conclusion: .Title and .TableOfContents should be in the same scope within single.html. But this doesn’t seem to be the case.

To answer questions like this, a link to a repo which reproduces this is needed.

Here’s the link to the repo’s partials.

That’s a whole lot of nothing (all the templates are zero bytes).

Back to guessing: You are trying to get the ToC from a Node (home page, section etc.). That isn’t available.

Why are the templates of the theme empty?

When calling nav.html inside of default/single.html with {{ partial "nav" . }} I’m passing all data from the current page to the template.

Edit: When calling {{ $.TableOfContents }} the terminal shows <$.TableOfContents>: TableOfContents is not a field of struct type *hugolib.Node in theme/partials/nav.html. So it seems that I call this variable from a node.

Edit 2: I’ve the function .IsNode which always true for nodes. I included in the nav.html and the returned value is false.