Omphaloskepsis-2/layouts/partials/single/main-header/toc.html

35 lines
1,016 B
HTML
Raw Permalink Normal View History

{{- /*
Renders appendices and corrigenda for an item.
@params toc The page ToC.
@params appendices The item's appendices. Optional.
@params fileDir The file folder name.
*/
-}}
{{ $empty_toc_html := "<nav id=\"TableOfContents\"></nav>" }}
{{ if and ( .toc ) ( ne .toc $empty_toc_html ) }}
<nav class="article-header__table-of-contents">
<h3 class="article-header__subtitle">Table of Contents</h3>
{{ .toc }}
{{- if fileExists ( path.Join .fileDir "appendices.md" ) -}}
<ul class="toc-list--appendices">
<li>
<a href="#appendices">Appendices</a>
<ol>
{{ range .appendices }}
<li><a href="#{{ . | anchorize }}">{{ . | safeHTML }}</a></li>
{{ end }}
</ol>
</li>
</ul>
{{- end -}}
{{- if fileExists ( path.Join .fileDir "corrigenda.md" ) -}}
<ul class="toc-list--corrigenda">
<li><a href="#corrigenda">Corrigenda</a></li>
</ul>
{{- end -}}
</nav>
{{ end }}