Function to indicate whether the current page has table of contents.
Become a backer or sponsor to support our work.
The .TableOfContents
is not always empty string when there is no table of contents, it may be <nav id="TableOfContents"></nav>
, and the function is used to deal with this case.
The function accepts the page variable as the context, and return a boolean value indicates whether the given page has table of contents.
1{{ if partial "base/functions/has-toc" . }}
2 {{ .TableOfContents }}
3{{ end }}