summaryrefslogtreecommitdiffstats
path: root/layouts/partials/sidebar.html
blob: 57bca9d0246f733457f088b3a97747b26b691b99 (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
{{/* 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 }}" {{- if eq .Params.external true }} target="_blank" rel="noopener noreferrer"{{ end }}>
            {{- $text := print .Name | safeHTML -}}
            {{- $text -}}
        </a>
        {{- end -}}
        {{/* TODO: Add hypothesis support */}}
    </nav>

    <div class="sidebar-item">
        <p>
            {{- with site.Params.footer }}
            {{ . | safeHTML }}
            {{- else }}
            Built with <a href="https://github.com/sergeyklay/gohugo-theme-ed" target="_blank" rel="noopener noreferrer">Ed.</a>
            Distributed under an MIT license.
            {{- end }}
        </p>
    </div>
</aside>