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