about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNgô Ngọc Đức Huy <huyngo@disroot.org>2023-08-04 10:19:40 +0700
committerNgô Ngọc Đức Huy <huyngo@disroot.org>2023-08-04 10:19:40 +0700
commitedaf609e338fcdd2d622878fc7d4178c7d7652da (patch)
treea811ea9bd10d75f0ae375118d71643668d041df1
parentcf91ff39630cead0fad16c16858405b3efbe7994 (diff)
downloadvictor-edaf609e338fcdd2d622878fc7d4178c7d7652da.tar.gz
Mark current page as current page
-rw-r--r--layouts/_default/baseof.html2
-rw-r--r--layouts/partials/header.html14
2 files changed, 13 insertions, 3 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index f53932d..86a13fe 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -9,7 +9,7 @@ SPDX-License-Identifier: MIT
 <html lang="{{ .Page.Language.Lang }}">
 <head>
     {{ block "head" . }}
-        {{ partial "head.html" . }}
+        {{ partialCached "head.html" . }}
     {{ end }}
 </head>
 <body>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 7b35a2a..58625fe 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,6 +1,16 @@
 <nav>
-	<a href="{{ .Site.Home.RelPermalink | absLangURL }}" >{{ .Site.Title }}</a>
+	{{ $current := .RelPermalink }}
+	{{ if eq $current .Site.Home.RelPermalink }}
+	<a aria-current="page">{{ .Site.Title }}</a>
+	{{ else }}
+	<a href="{{ .Site.Home.RelPermalink }}" >{{ .Site.Title }}</a>
+	{{ end}}
+
 	{{ range .Site.Menus.main }}
-	<a href="{{ .URL | absLangURL }}">{{ .Title }}</a>
+	{{ if eq $current .URL }}
+	<a aria-current="page">{{ .Title }}</a>
+	{{ else }}
+	<a href="{{ .URL }}">{{ .Title }}</a>
+	{{ end }}
 	{{ end }}
 </nav>