2020-02-16 22:40:02 +00:00
|
|
|
{{ $tocLevels := default (default 6 .Site.Params.GeekdocToC) .Page.Params.GeekdocToC }}
|
|
|
|
|
|
|
|
{{ if $tocLevels }}
|
2020-04-14 23:09:53 +00:00
|
|
|
<div class="gdoc-toc gdoc-toc__level--{{$tocLevels}}">
|
|
|
|
{{ template "toc-tree" dict "sect" .Page.Pages }}
|
|
|
|
</div>
|
2020-02-16 22:40:02 +00:00
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
<!-- templates -->
|
|
|
|
{{ define "toc-tree" }}
|
2020-04-14 23:09:53 +00:00
|
|
|
<ul>
|
|
|
|
{{ range .sect.GroupBy "Weight" }}
|
|
|
|
{{ range .ByTitle }}
|
2020-11-11 10:48:25 +00:00
|
|
|
{{ if or (not .Params.GeekdocHidden) (not (default true .Params.GeekdocHiddenTocTree)) }}
|
2020-04-14 23:09:53 +00:00
|
|
|
<li>
|
2020-11-11 10:48:25 +00:00
|
|
|
{{ if or .Content .Params.GeekdocFlatSection }}
|
2020-04-14 23:09:53 +00:00
|
|
|
<span>
|
2020-11-10 21:05:56 +00:00
|
|
|
<a href="{{ .RelPermalink }}" class="gdoc-toc__entry">{{ partial "title" . }}{{ with .Params.GeekdocDescription }}:</a> {{ . }}{{ else }}</a>{{ end }}
|
2020-04-14 23:09:53 +00:00
|
|
|
</span>
|
|
|
|
{{ else }}
|
2020-11-10 21:05:56 +00:00
|
|
|
<span>{{ partial "title" . }}{{ with .Params.GeekdocDescription }}: {{ . }}{{ end }}</span>
|
2020-04-14 23:09:53 +00:00
|
|
|
{{ end }}
|
2020-02-16 22:40:02 +00:00
|
|
|
|
2020-04-14 23:09:53 +00:00
|
|
|
{{ $numberOfPages := (add (len .Pages) (len .Sections)) }}
|
2020-11-11 10:48:25 +00:00
|
|
|
{{ if and (ne $numberOfPages 0) (not .Params.GeekdocFlatSection) }}
|
2020-04-14 23:09:53 +00:00
|
|
|
{{ template "toc-tree" dict "sect" .Pages }}
|
|
|
|
{{ end }}
|
|
|
|
</li>
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
</ul>
|
2020-02-16 22:40:02 +00:00
|
|
|
{{ end }}
|