refactor: split single header and meta components into partials
This commit is contained in:
parent
d0577aec91
commit
e6889cabba
22 changed files with 742 additions and 406 deletions
34
layouts/partials/single/main-header/toc.html
Normal file
34
layouts/partials/single/main-header/toc.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
{{- /*
|
||||
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 }}
|
Loading…
Add table
Add a link
Reference in a new issue