From 6770e5e552bc367181f3786169e614683fadeb16 Mon Sep 17 00:00:00 2001 From: Aditya Telange <21258296+adityatelange@users.noreply.github.com> Date: Sun, 20 Sep 2020 19:03:43 +0530 Subject: [PATCH] menu : add menu location indicator credits for fix with [.IsMenuCurrent](https://gohugo.io/functions/ismenucurrent/): https://stackoverflow.com/a/56454338 --- assets/css/header.css | 5 +++++ layouts/_default/baseof.html | 2 +- layouts/partials/header.html | 11 ++++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/assets/css/header.css b/assets/css/header.css index 0263bd3e..e12814d8 100644 --- a/assets/css/header.css +++ b/assets/css/header.css @@ -38,4 +38,9 @@ .menu a { font-size: 16px; +} + +.menu .active { + font-weight: 500; + border-bottom: 2px solid currentColor; } \ No newline at end of file diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index c2cb5679..7253249f 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -8,7 +8,7 @@ - {{- partialCached "header.html" . }} + {{- partialCached "header.html" . .Page}}
{{- block "main" . }} {{end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 7be916c3..6c02c7c8 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -12,14 +12,19 @@ {{- else }} {{- end }} - {{- if .Site.Menus.main }} + {{ $currentPage := . }} - {{- end }} \ No newline at end of file