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

github.com/thomasheller/crab.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Heller <thomas.m.heller@gmail.com>2019-05-31 19:56:12 +0300
committerThomas Heller <thomas.m.heller@gmail.com>2019-05-31 19:56:12 +0300
commit1b0251ceb5a8cd9347e662cc2336b7767f2df4b0 (patch)
treed1ef5b25732ffafbd3da456ed72540d8f39be918
parent66b733b102660b56a0f1d3c6e8a2eaed2543cebf (diff)
Highlight currently active menu item - fixes #15
-rw-r--r--layouts/partials/header.html4
-rw-r--r--layouts/partials/menu.html43
-rw-r--r--static/css/crab.css4
3 files changed, 27 insertions, 24 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index b314468..4b502f4 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -7,8 +7,6 @@
<meta charset="utf-8">
{{ hugo.Generator }}
-
-
{{ if isset .Site.Params "mathjax"}}
<script type="text/javascript" src="{{ .Site.Params.mathjax }}">
</script>
@@ -34,7 +32,7 @@
</div>
- {{ partial "menu.html" .Site.Menus.main }}
+ {{ partial "menu.html" . }}
<div id="content">
diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html
index 4f8054e..1f6e972 100644
--- a/layouts/partials/menu.html
+++ b/layouts/partials/menu.html
@@ -1,23 +1,24 @@
<nav>
- <ul class="first">
- {{ range . }}
- <li><a href="{{.URL}}">{{ .Name }}{{ if .HasChildren }} &raquo;{{ end }}</a>
- {{ if .HasChildren }}
- <ul class="second">
- {{ range .Children }}
- <li><a href="{{.URL}}">{{ .Name }}{{ if .HasChildren }} &raquo;{{ end }}</a>
- {{ if .HasChildren }}
- <ul class="third">
- {{ range .Children }}
- <li><a href="{{.URL}}">{{ .Name }}</a></li>
- {{ end }}
- </ul>
- {{ end }}
- </li>
- {{ end }}
- </ul>
- {{ end }}
- </li>
- {{ end }}
- </ul>
+ <ul class="first">
+ {{ $rel := $.Page.RelPermalink }}
+ {{ range .Site.Menus.main }}
+ <li><a href="{{.URL}}"{{ if eq $rel .URL }} class="current"{{end}}>{{ .Name }} {{ if .HasChildren }} &raquo;{{ end }}</a>
+ {{ if .HasChildren }}
+ <ul class="second">
+ {{ range .Children }}
+ <li><a href="{{.URL}}"{{ if eq $rel .URL }} class="current"{{end}}>{{ .Name }}{{ if .HasChildren }} &raquo;{{ end }}</a>
+ {{ if .HasChildren }}
+ <ul class="third">
+ {{ range .Children }}
+ <li><a href="{{.URL}}"{{ if eq $rel .URL }} class="current"{{end}}>{{ .Name }}</a></li>
+ {{ end }}
+ </ul>
+ {{ end }}
+ </li>
+ {{ end }}
+ </ul>
+ {{ end }}
+ </li>
+ {{ end }}
+ </ul>
</nav>
diff --git a/static/css/crab.css b/static/css/crab.css
index 44d4a2d..3814c56 100644
--- a/static/css/crab.css
+++ b/static/css/crab.css
@@ -85,6 +85,10 @@ nav a:hover {
color: #1da8be;
}
+nav .current {
+ font-weight: bold;
+}
+
#content,
#footer,
hr {