16 lines
422 B
HTML
16 lines
422 B
HTML
|
{{ $headings := findRE "<h2.*?>(.|\n])+?</h2>" .Content }}
|
||
|
{{ if ge (len $headings) 2 }}
|
||
|
<nav class="toc" aria-labelledby="toc-heading">
|
||
|
<h2 id="toc-heading">Table of contents</h2>
|
||
|
<ol>
|
||
|
{{ range $headings }}
|
||
|
<li>
|
||
|
<a href="#{{ . | htmlUnescape | plainify | urlize }}">
|
||
|
{{ . | htmlUnescape | plainify }}
|
||
|
</a>
|
||
|
</li>
|
||
|
{{ end }}
|
||
|
</ol>
|
||
|
</nav>
|
||
|
{{ end }}
|