2024-01-12 10:56:06 +00:00
|
|
|
{{- $current := . }}
|
2023-06-22 07:45:54 +00:00
|
|
|
{{- $tocLevels := default (default 6 .Site.Params.geekdocToC) .Page.Params.geekdocToC }}
|
2024-01-12 10:56:06 +00:00
|
|
|
{{- $sortBy := (default (default "title" .Site.Params.geekdocFileTreeSortBy) (.Get "sortBy") | lower) }}
|
2020-02-16 22:40:02 +00:00
|
|
|
|
2022-05-22 20:07:35 +00:00
|
|
|
{{- if $tocLevels }}
|
2022-01-06 12:58:10 +00:00
|
|
|
<div class="gdoc-toc gdoc-toc__level--{{ $tocLevels }}">
|
2024-01-12 10:56:06 +00:00
|
|
|
{{ template "toc-tree" dict "sect" .Page.Pages "current" $current "sortBy" $sortBy }}
|
2020-04-14 23:09:53 +00:00
|
|
|
</div>
|
2022-05-22 20:07:35 +00:00
|
|
|
{{- end }}
|
2020-02-16 22:40:02 +00:00
|
|
|
|
2022-01-06 12:58:10 +00:00
|
|
|
|
2020-02-16 22:40:02 +00:00
|
|
|
<!-- templates -->
|
2022-05-22 20:07:35 +00:00
|
|
|
{{- define "toc-tree" }}
|
2020-04-14 23:09:53 +00:00
|
|
|
<ul>
|
2024-01-12 10:56:06 +00:00
|
|
|
{{ range .sect.GroupBy "Weight" }}
|
|
|
|
{{ $rangeBy := .ByTitle }}
|
|
|
|
|
|
|
|
{{ if eq $.sortBy "title" }}
|
|
|
|
{{ $rangeBy = .ByTitle }}
|
|
|
|
{{ else if eq $.sortBy "linktitle" }}
|
|
|
|
{{ $rangeBy = .ByLinkTitle }}
|
|
|
|
{{ else if eq $.sortBy "date" }}
|
|
|
|
{{ $rangeBy = .ByDate }}
|
|
|
|
{{ else if eq $.sortBy "publishdate" }}
|
|
|
|
{{ $rangeBy = .ByPublishDate }}
|
|
|
|
{{ else if eq $.sortBy "expirydate" }}
|
|
|
|
{{ $rangeBy = .ByExpiryDate }}
|
|
|
|
{{ else if eq $.sortBy "lastmod" }}
|
|
|
|
{{ $rangeBy = .ByLastmod }}
|
|
|
|
{{ else if eq $.sortBy "title_reverse" }}
|
|
|
|
{{ $rangeBy = .ByTitle.Reverse }}
|
|
|
|
{{ else if eq $.sortBy "linktitle_reverse" }}
|
|
|
|
{{ $rangeBy = .ByLinkTitle.Reverse }}
|
|
|
|
{{ else if eq $.sortBy "date_reverse" }}
|
|
|
|
{{ $rangeBy = .ByDate.Reverse }}
|
|
|
|
{{ else if eq $.sortBy "publishdate_reverse" }}
|
|
|
|
{{ $rangeBy = .ByPublishDate.Reverse }}
|
|
|
|
{{ else if eq $.sortBy "expirydate_reverse" }}
|
|
|
|
{{ $rangeBy = .ByExpiryDate.Reverse }}
|
|
|
|
{{ else if eq $.sortBy "lastmod_reverse" }}
|
|
|
|
{{ $rangeBy = .ByLastmod.Reverse }}
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
{{ range $rangeBy }}
|
2023-06-22 07:45:54 +00:00
|
|
|
{{- if or (not .Params.geekdocHidden) (not (default true .Params.geekdocHiddenTocTree)) }}
|
2022-01-06 12:58:10 +00:00
|
|
|
<li>
|
2023-06-22 07:45:54 +00:00
|
|
|
{{- if or .Content .Params.geekdocFlatSection }}
|
2022-01-06 12:58:10 +00:00
|
|
|
<span>
|
|
|
|
<a href="{{ .RelPermalink }}" class="gdoc-toc__entry">
|
2023-06-22 07:45:54 +00:00
|
|
|
{{- partial "utils/title" . }}{{ with .Params.geekdocDescription }}:{{ end }}
|
2022-01-06 12:58:10 +00:00
|
|
|
</a>
|
2023-06-22 07:45:54 +00:00
|
|
|
{{- with .Params.geekdocDescription }}{{ . }}{{ end }}
|
2022-01-06 12:58:10 +00:00
|
|
|
</span>
|
2022-05-22 20:07:35 +00:00
|
|
|
{{- else -}}
|
2022-01-06 12:58:10 +00:00
|
|
|
<span>
|
2023-06-22 07:45:54 +00:00
|
|
|
{{- partial "utils/title" . }}{{ with .Params.geekdocDescription }}
|
|
|
|
: {{ . }}
|
|
|
|
{{ end }}
|
2022-01-06 12:58:10 +00:00
|
|
|
</span>
|
2022-05-22 20:07:35 +00:00
|
|
|
{{- end -}}
|
2020-02-16 22:40:02 +00:00
|
|
|
|
2022-05-22 20:07:35 +00:00
|
|
|
{{- $numberOfPages := (add (len .Pages) (len .Sections)) }}
|
2023-06-22 07:45:54 +00:00
|
|
|
{{- if and (ne $numberOfPages 0) (not .Params.geekdocFlatSection) }}
|
2022-05-22 20:07:35 +00:00
|
|
|
{{- template "toc-tree" dict "sect" .Pages }}
|
|
|
|
{{- end }}
|
2022-01-06 12:58:10 +00:00
|
|
|
</li>
|
2022-05-22 20:07:35 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2020-04-14 23:09:53 +00:00
|
|
|
</ul>
|
2022-05-22 20:07:35 +00:00
|
|
|
{{- end }}
|