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

github.com/curttimson/hugo-theme-massively.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaximilian Appel <43109991+muxmuse@users.noreply.github.com>2022-05-10 14:11:34 +0300
committerGitHub <noreply@github.com>2022-05-10 14:11:34 +0300
commitd483c036002f47fc522069eb6c13e2aaea91b299 (patch)
treeb8442b6be5fc5dad0f6e43a32ca60291ddde349a
parent74065c9c951193333d39aabc2045cc4fac10dc9b (diff)
Highlight active page (#110)v6.5.0
* + display nav link as active based on page url * r remove unnecessary print instruction Co-authored-by: muxmuse <mail@maxappel.de>
-rw-r--r--layouts/partials/nav.html5
1 files changed, 3 insertions, 2 deletions
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
index e8237e2..b6ccdf1 100644
--- a/layouts/partials/nav.html
+++ b/layouts/partials/nav.html
@@ -1,11 +1,12 @@
<!-- Nav -->
{{ $data := index .Site.Data .Site.Language.Lang }}
+{{ $currentPage := .Page }}
<nav id="nav">
<ul class="links">
- <li class="active"><a href='{{ "/" | relLangURL }}'>{{ .Site.Title }}</a></li>
+ <li class="{{ if eq ($currentPage.RelPermalink) (`/`) }}active{{end}}"><a href='{{ "/" | relLangURL }}'>{{ .Site.Title }}</a></li>
{{- with $data.nav.items -}}
{{- range $i, $e := . -}}
- <li><a href='{{ .url | relLangURL }}'>{{- .title -}}</a></li>
+ <li class="{{ if eq ($currentPage.RelPermalink) (print .url `/`) }}active{{end}}"><a href='{{ .url | relLangURL }}'>{{- .title -}}</a></li>
{{- end -}}
{{- end -}}
{{ with $data.contactinfo }}