hugo-book/layouts/partials/docs/shared.html
2019-02-13 23:31:13 +01:00

26 lines
743 B
HTML

{{/*These templates contains some more complex logic and shared between partials*/}}
{{ define "title" }}
{{- if .Pages -}}
{{ $sections := split (trim .Dir "/") "/" }}
{{ $title := index ($sections | last 1) 0 | humanize | title }}
{{- default $title .Title -}}
{{- else -}}
{{ $title := .File | humanize | title }}
{{- 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 }}