summaryrefslogtreecommitdiffstats
path: root/layouts/partials/sidebar.html
blob: d9f64e1a2b9c8c792c3a597c3c2ab038fc497c00 (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
{{/* 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>
            Built with <a href="https://github.com/sergeyklay/gohugo-theme-ed" target="_blank">Ed.</a>
            Distributed under an MIT license.
        </p>
    </div>
</aside>