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

github.com/thingsym/hugo-theme-techdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYosuke Mizuno <thingsym@gmail.com>2022-07-06 13:00:20 +0300
committerGitHub <noreply@github.com>2022-07-06 13:00:20 +0300
commitf2816255e4d518e6bd89f8b08f71d3bd9961c4fb (patch)
tree2cf2d8cd21eff29471e53c6387c6b3ebee33396b
parent4c28114f1d600868091a1ad6213298b159efc48d (diff)
parent16b83dbd1ee86be37c1cea8271b677e2d0e7b126 (diff)
Merge pull request #48 from cengique/master
pre and post elements added to menu items
-rw-r--r--layouts/partials/global-menu.html20
1 files changed, 17 insertions, 3 deletions
diff --git a/layouts/partials/global-menu.html b/layouts/partials/global-menu.html
index bd2dabd..132b26f 100644
--- a/layouts/partials/global-menu.html
+++ b/layouts/partials/global-menu.html
@@ -5,18 +5,32 @@
<ul>
{{- range .Site.Menus.main.ByWeight -}}
{{ if .HasChildren -}}
-<li class="parent{{ if $currentPage.HasMenuCurrent "main" . }} active{{ end }}"><a href="{{ .URL }}">{{- .Name -}} <i class="fas fa-angle-right"></i></a>
+<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 }}"><a href="{{ .URL }}">{{ .Name }}</a></li>
+<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 }}><a href="{{ .URL }}">{{- .Name -}}</a></li>
+<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 -}}
+