2020-02-16 23:40:02 +01:00
|
|
|
{{ $tocLevels := default (default 6 .Site.Params.GeekdocToC) .Page.Params.GeekdocToC }}
|
|
|
|
|
|
|
|
{{ if $tocLevels }}
|
2020-04-15 01:09:53 +02:00
|
|
|
<div class="gdoc-toc gdoc-toc__level--{{$tocLevels}}">
|
|
|
|
{{ template "toc-tree" dict "sect" .Page.Pages }}
|
|
|
|
</div>
|
2020-02-16 23:40:02 +01:00
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
<!-- templates -->
|
|
|
|
{{ define "toc-tree" }}
|
2020-04-15 01:09:53 +02:00
|
|
|
<ul>
|
|
|
|
{{ range .sect.GroupBy "Weight" }}
|
|
|
|
{{ range .ByTitle }}
|
|
|
|
{{ if not .Params.geekdocHidden }}
|
|
|
|
<li>
|
|
|
|
{{ if or .Content .Params.geekdocFlatSection }}
|
|
|
|
<span>
|
|
|
|
<a href="{{ .RelPermalink }}" class="gdoc-toc__entry">{{ partial "title" . }}</a>
|
|
|
|
</span>
|
|
|
|
{{ else }}
|
|
|
|
<span>{{ partial "title" . }}</span>
|
|
|
|
{{ end }}
|
2020-02-16 23:40:02 +01:00
|
|
|
|
2020-04-15 01:09:53 +02:00
|
|
|
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
|
|
|
|
{{ if and (ne $numberOfPages 0) (not .Params.geekdocFlatSection) }}
|
|
|
|
{{ template "toc-tree" dict "sect" .Pages }}
|
|
|
|
{{ end }}
|
|
|
|
</li>
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
</ul>
|
2020-02-16 23:40:02 +01:00
|
|
|
{{ end }}
|