/
structure.html
48 lines (41 loc) · 1.42 KB
/
structure.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{{$home := site.Home }}
<h3>Content Structure</h3>
<div class="card content-structure">
<div class="card-content">
{{ template "content-structure" (dict "currentLevel" $home "currentPage" . "level" 0 ) }}
</div>
</div>
<hr>
{{ define "content-structure" }}
{{ $level := .level }}
{{ $currentLevel := .currentLevel }}
{{ $currentPage := .currentPage }}
{{ if $currentLevel.IsNode }}
{{ $children := $currentLevel.Pages }}
<span class="{{cond $currentLevel.IsHome "is-size-4" "" }}">
{{ $isred := eq $currentPage.Permalink $currentLevel.Permalink }}
{{ $isred = or $isred (in $currentLevel.RegularPagesRecursive $currentPage) }}
<a href="{{$currentLevel.Permalink}}" class="{{ cond ($isred) "has-text-danger has-text-weight-bold" ""}}">
{{$currentLevel.Title}}
</a>
{{with $currentLevel.File}}<span class="has-text-grey-light"> {{.}}</span>{{end}}
</span>
<ol>
{{ range $children }}
{{ if .IsNode }}
<li>
{{template "content-structure" (dict "currentLevel" . "currentPage" $currentPage "level" (add 1 $level) ) }}
</li>
{{ else }}
<li>
<a href="{{.Permalink}}" class="{{ cond (eq . $currentPage) "has-text-danger has-text-weight-bold" ""}}">
{{ .Title }}
</a>
{{with .File}}<span class="has-text-grey-light"> {{.}}</span>{{end}}
</li>
{{ end }}
{{ end }}
</ol>
{{ end }}
<!-- End template -->
{{ end }}