• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<div class="toc">
2<p><b>Table of Contents</b></p>
3<dl class="toc">
4{{- $tocdepth := .toc_depth }}
5{{- with .context }}
6  {{- if eq .Site.Params.ordersectionsby "title"}}
7    {{- range .Site.Home.Sections.ByTitle}}
8    {{- template "section-tree-nav" dict "sect" . "currentnode" . "count" 1 "tocdepth" $tocdepth}}
9    {{- end}}
10  {{- else}}
11    {{- range .Site.Home.Sections.ByWeight}}
12    {{- template "section-tree-nav" dict "sect" . "currentnode" . "count" 1 "tocdepth" $tocdepth}}
13    {{- end}}
14  {{- end}}
15{{- end}}
16
17<!-- templates -->
18{{- define "section-tree-nav" }}
19{{- $currentNode := .currentnode }}
20 {{- with .sect}}
21  <dt><span class="section"><a href="{{ .RelPermalink}}">{{.Title | markdownify}}</a></span></dt>
22  {{- if lt $.count $.tocdepth }}
23    {{- if and .IsSection (or (not .Params.hidden) $.showhidden)}}
24      {{- $numberOfPages := (add (len .Pages) (len .Sections)) }}
25      {{- if ne $numberOfPages 0 }}
26        <dd><dl>
27          {{- .Scratch.Set "pages" .Pages }}
28          {{- if .Sections}}
29          {{- .Scratch.Set "pages" (.Pages | union .Sections) }}
30          {{- end}}
31          {{- $pages := (.Scratch.Get "pages") }}
32
33        {{- if eq .Site.Params.ordersectionsby "title"}}
34          {{- range $pages.ByTitle }}
35            {{- if and .Params.hidden (not $.showhidden) }}
36            {{- else}}
37              {{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "count" (add $.count 1) "tocdepth" $.tocdepth }}
38            {{- end}}
39          {{- end}}
40        {{- else}}
41          {{- range $pages.ByWeight }}
42            {{- if and .Params.hidden (not $.showhidden) }}
43            {{- else}}
44              {{- template "section-tree-nav" dict "sect" . "currentnode" $currentNode "count" (add $.count 1) "tocdepth" $.tocdepth }}
45            {{- end}}
46          {{- end}}
47        {{- end}}
48        </dl></dd>
49      {{- end}}
50    {{- end}}
51  {{- end}}
52 {{- end}}
53{{- end}}
54</dl>
55</div>