#22: Move href hack to partial

pull/34/head
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 }}