diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2022-05-08 15:44:18 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <egrep@protonmail.ch> | 2022-05-08 15:44:18 +0200 |
| commit | 1f6ece84ae9d201271506a4672ecf86d0a952658 (patch) | |
| tree | c26fc6bf612337bbe1548ca9c60e10f9f56aa610 /layouts/partials | |
| parent | b4f61294a8865c6279dd55f30dbccf4b11b7167d (diff) | |
| download | gohugo-theme-ed-1f6ece84ae9d201271506a4672ecf86d0a952658.tar.gz | |
Rework sidebar
Diffstat (limited to 'layouts/partials')
| -rw-r--r-- | layouts/partials/sidebar.html | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index f46c663..d9f64e1 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -8,22 +8,17 @@ </div> <nav class="sidebar-nav"> - <a class="sidebar-nav-item{{- if .IsHome }} active{{ end -}}" href="{{ site.Home.RelPermalink }}">Home</a> - {{- $current := . }} - {{- /* TODO: Render items dynamically */}} - {{- range site.Menus.nav }} - {{- $active := or ($current.IsMenuCurrent "nav" .) ($current.HasMenuCurrent "nav" .) }} + {{- 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 }}"> + <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 */}} - {{- with site.Params.github_url }} - <a class="sidebar-nav-item" href="{{ . }}" target="_blank">GitHub project</a> - {{- end }} </nav> <div class="sidebar-item"> |
