summaryrefslogtreecommitdiffstats
path: root/layouts/partials/sidebar.html
blob: 41652db11ef71c85039e0300d166a95935f35812 (plain)
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
{{/* Target for toggling the sidebar `.sidebar-checkbox` is for regular styles,
    `#sidebar-checkbox` for behavior. */}}
<input type="checkbox" class="sidebar-checkbox" id="sidebar-checkbox">

{{/* Toggleable sidebar */}}
<aside class="sidebar" id="sidebar">
    <div class="sidebar-item">
        <p>{{ site.Params.Description }}</p>
    </div>

    <nav class="sidebar-nav">
        {{ $current := . }}
        {{ range site.Menus.main }}
            {{ $active := or ($current.IsMenuCurrent "main" .) ($current.HasMenuCurrent "main" .) }}
            {{ $active = or $active (eq .URL $current.RelPermalink) }}
            {{ $active = or $active (eq .Name $current.Title) }}
            <a class="sidebar-nav-item{{ if $active }} active{{ end }}"
                href="{{ .URL }}"
                id="menu-main-{{ .Identifier }}"
                {{- if eq .Params.external true }} target="_blank" rel="noopener noreferrer"{{ end }}>
                {{- print .Name | safeHTML -}}
            </a>
        {{ end }}

        {{/* TODO: Add hypothesis support */}}

        {{ with site.Menus.feeds }}
            <div class="sidebar-nav-item">
                {{ range $i, $ := site.Menus.feeds }}
                    {{ if $i }}<span aria-hidden="true">|</span>{{ end }}
                    <a href="{{ .URL }}" id="menu-feeds-{{ .Identifier }}">
                        {{  print .Name | safeHTML }}
                    </a>
                {{ end }}
            </div>
        {{ end }}
    </nav>

    {{ partial "footer" . }}
</aside>