-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathsidebar.html
More file actions
100 lines (90 loc) · 4.7 KB
/
sidebar.html
File metadata and controls
100 lines (90 loc) · 4.7 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
{{/* (C) 2023 GoodData Corporation */}}
<button type="button" id="gd-docs-menu__mobile-trigger" class="gd-docs-menu__mobile-btn" aria-expanded="false" aria-controls="gd-docs-menu" aria-label="Toggle navigation menu">
<span class="gd-docs-menu__mobile-icon" aria-hidden="true"></span>
</button>
<div class="gd-docs-menu__mobile-bg"></div>
<nav id="gd-docs-menu" class="gd-docs-menu init" aria-label="Articles">
{{ if .Site.Params.versions }}
{{ partial "navbar-version-selector.html" . }}
{{ end }}
{{ partial "sidebar-tree.html" . }}
</nav>
{{ define "root-link" }}
{{ $isCurrent := eq .currentPage .root.FirstSection }}
{{ $active := .active }}
{{ with .root }}
<ul class="gd-docs-menu-section gd-docs-menu-section__root">
<li class="gd-docs-menu-page{{ if or $isCurrent $active }} active{{ end }}">
<div class="gd-docs-menu-page__title">
{{- if and .RelPermalink (ne .RelPermalink "") -}}
<a href="{{ .RelPermalink }}" class="gd-docs-menu-page__link">{{ .LinkTitle }}</a>
{{- else -}}
<span class="gd-docs-menu-page__link">{{ .LinkTitle }}</span>
{{- end }}
</div>
</li>
</ul>
{{ end }}
{{ end }}
{{ define "section-tree-nav-sections" }}
{{ $root := .root }}
{{ $site := .site }}
{{ $currentPage := .currentPage }}
{{ $firstInSection := (index $root 0) }}
{{ $isRootSection := eq $firstInSection.Parent .site.Home }}
{{ if gt (len (where $root.ByWeight "Params.toc_hide" "ne" true)) 0 }}
<ul class="gd-docs-menu-section{{ if .activeSection }} active{{ end }}">
{{ range $page := $root.ByWeight }}
{{ $page := $page.Page }}
{{ $pageId := replace (replaceRE "^/|/$" "" $page.RelPermalink) "/" "_" }}
{{ if and (not (eq $page.Params.toc_hide true)) (not (eq $page $site.Home)) }}
{{ $activePage := eq $page $currentPage }}
{{ $activeSection := or $activePage ($currentPage.IsDescendant $page) }}
{{ $pageId := replace (replaceRE "^/|/$" "" $page.RelPermalink) "/" "_" }}
<li class="gd-docs-menu-page{{ if $activePage }} active{{ end }}{{ if $page.Params.navSeparator }} gd-docs-menu-page__separator{{ end }}">
{{ if $page.Params.navigationLabel }}
<span class="gd-docs-menu-page__label">{{ $page.LinkTitle }}</span>
{{ else }}
<div class="gd-docs-menu-page__title">
{{- if and $page.Params.externalLink (ne $page.Params.externalLink "") -}}
<a href="{{ $page.Params.externalLink }}" class="gd-docs-menu-page__link" target="_blank">{{ $page.LinkTitle }}</a>
{{- else if and $page.Permalink (ne $page.Permalink "") -}}
<a href="{{ $page.Permalink }}" class="gd-docs-menu-page__link">{{ $page.LinkTitle }}</a>
{{- else -}}
<span class="gd-docs-menu-page__link">{{ $page.LinkTitle }}</span>
{{- end }}
{{ if $page.Pages }}
<button
type="button"
id="btn-{{ $pageId }}"
class="gd-docs-menu-page__toggle-btn"
aria-expanded="{{ if $activeSection }}true{{ else }}false{{ end }}"
aria-controls="section-{{ $pageId }}"
aria-label="{{ if $activeSection }}Collapse{{ else }}Expand{{ end }} {{ $page.LinkTitle }} section">
<span class="gd-docs-menu-page__chevron">
{{ with resources.Get "icons/chevron-menu.svg" }}
{{ $svg := . | minify }}
{{ $svg := replace $svg.Content "<svg " "<svg aria-hidden=\"true\" focusable=\"false\" " }}
{{ $svg | safeHTML }}
{{ end }}
</span>
</button>
{{ end }}
</div>
{{ if $page.Pages }}
<div id="section-{{ $pageId }}" class="gd-docs-menu-section-wrapper{{ if $activeSection }} expanded{{ end }}">
{{ template "section-tree-nav-sections" (dict "root" $page.Pages "currentPage" $currentPage "activeSection" $activeSection "site" $site) }}
</div>
{{ end }}
{{ end }}
</li>
{{ if and $page.Params.navigationLabel $page.Pages }}
<li class="gd-docs-menu-page">
{{ template "section-tree-nav-sections" (dict "root" $page.Pages "currentPage" $currentPage "activeSection" $activeSection "site" $site) }}
</li>
{{ end }}
{{ end }}
{{ end }}
</ul>
{{ end }}
{{ end }}