blob: ec303f5d2c8a1c2e483a3de69447def3f8a8ce9a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
{{/*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 -}}
{{- define "jsmenu" -}}
<script>
(function() {
var menu = document.querySelector('aside.book-menu nav')
addEventListener('beforeunload', function(event) {
localStorage.setItem('menu.scrollTop', menu.scrollTop)
});
menu.scrollTop = localStorage.getItem('menu.scrollTop')
})()
</script>
{{- end -}}
|