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

github.com/zwbetz-gh/vanilla-bootstrap-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Grimm <fgr@users.noreply.github.com>2019-11-14 07:35:40 +0300
committerzwbetz-gh <37317628+zwbetz-gh@users.noreply.github.com>2019-11-14 07:35:40 +0300
commit81948de2a4eb059526963087cf5efc65c75532a2 (patch)
tree4c5da8d08007f4a867c47b97f465eaa8db6b71eb
parent276594607a8fb3836fbe7638dcc1f9d53c19f856 (diff)
Added identification of current navigation menu item based on the page identifier (#12)
-rw-r--r--layouts/partials/nav.html3
1 files changed, 2 insertions, 1 deletions
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
index 675b466..53ceb21 100644
--- a/layouts/partials/nav.html
+++ b/layouts/partials/nav.html
@@ -6,6 +6,7 @@
{{ $active := "" }}
{{ if eq $showActiveNav true }}
{{ $isMenu := or ($currentPage.IsMenuCurrent "nav" .) ($currentPage.HasMenuCurrent "nav" .) }}
+ {{ $isMenu = or $isMenu (eq $currentPage.Params.identifier .Identifier) }}
{{ $isMenu = or $isMenu (eq $currentPage.Title .Name) }}
{{ $isMenu = or $isMenu (and (eq .Name "Blog") (eq $currentPage.Section "post")) }}
{{ $isMenu = or $isMenu (and (eq .Name "Tags") (eq $currentPage.Section "tags")) }}
@@ -18,4 +19,4 @@
<a class="nav-link {{ $active }}" href="{{ .URL }}">{{ $text }}</a>
{{ end }}
</nav>
-</div> \ No newline at end of file
+</div>