aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorAlex Shpak <alex-shpak@users.noreply.github.com>2019-02-13 23:31:13 +0100
committerAlex Shpak <alex-shpak@users.noreply.github.com>2019-02-13 23:31:13 +0100
commit4297ab1c088fd14e037c019b1aabcba9577ba2d6 (patch)
tree0315afa956d11bc39c7f9bfc18d78c30f7bdef3d /layouts
parentfda5e7a046769b1bb814d6080f4cc9dae62ed39a (diff)
#22: Move href hack to partial
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/docs/menu-bundle.html6
-rw-r--r--layouts/partials/docs/shared.html15
2 files changed, 16 insertions, 5 deletions
diff --git a/layouts/partials/docs/menu-bundle.html b/layouts/partials/docs/menu-bundle.html
index 6cd0016..dbece6c 100644
--- a/layouts/partials/docs/menu-bundle.html
+++ b/layouts/partials/docs/menu-bundle.html
@@ -1,8 +1,4 @@
-<style>
-nav ul a[href$="{{- .RelPermalink -}}"] {
- color: {{ default "#004ed0" .Site.Params.BookMenuBundleActiveLinkColor }};
-}
-</style>
+{{- template "hrefhack" . -}}
{{ with .Site.GetPage .Site.Params.BookMenuBundle }}
{{- .Content -}}
{{ end }} \ No newline at end of file
diff --git a/layouts/partials/docs/shared.html b/layouts/partials/docs/shared.html
index 2027007..8354e6a 100644
--- a/layouts/partials/docs/shared.html
+++ b/layouts/partials/docs/shared.html
@@ -9,3 +9,18 @@
{{- default $title .Title -}}
{{- end -}}
{{ end }}
+
+{{ define "hrefhack" }}
+ {{ $attrEq := "$=" }}
+ {{ $attrVal := .RelPermalink }}
+ {{ if eq .RelPermalink "/" }}
+ {{ $attrEq = "=" }}
+ {{ $attrVal = .Permalink }}
+ {{ end }}
+
+ <style>
+ nav ul a[href{{ $attrEq }}"{{ $attrVal }}"] {
+ color: {{ default "#004ed0" .Site.Params.BookMenuBundleActiveLinkColor }};
+ }
+ </style>
+{{ end }} \ No newline at end of file