Welcome to mirror list, hosted at ThFree Co, Russian Federation.

global-menu.html « partials « layouts - github.com/thingsym/hugo-theme-techdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 132b26f0695f0336282742fbdbaf3388e46dec63 (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
{{ $currentPage := . }}
{{- if .Site.Menus.main -}}
<div class="global-menu">
<nav>
<ul>
{{- range .Site.Menus.main.ByWeight -}}
{{ if .HasChildren -}}
<li class="parent{{ if $currentPage.HasMenuCurrent "main" . }} active{{ end }}">{{template "menu-item" dict "item" .}}
<ul class="sub-menu">
{{ range .Children -}}
<li class="child{{ if $currentPage.HasMenuCurrent "main" . }} active{{ end }}">{{template "menu-item" dict "item" .}}</li>
{{ end -}}
</ul>
</li>
{{- else }}
<li{{ if $currentPage.HasMenuCurrent "main" . }} class="active"{{ end }}>{{template "menu-item" dict "item" .}}</li>
{{- end -}}
{{- end -}}
</ul>
</nav>
</div>
{{- end }}

{{define "menu-item"}}
{{- with .item -}}
<a href="{{ .URL }}">
  {{- with .Pre -}}{{- . -}}{{- end -}}
  {{- .Name -}}
  {{- with .Post -}}{{- . -}}{{- end -}}
  {{ if .HasChildren -}}
  <i class="fas fa-angle-right"></i>
  {{ end -}}  
</a>
{{- end -}}
{{- end -}}