#22: Move href hack to partial

This commit is contained in:
Alex Shpak 2019-02-13 23:31:13 +01:00
parent fda5e7a046
commit 4297ab1c08
2 changed files with 16 additions and 5 deletions

View file

@ -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 }}

View file

@ -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 }}