2019-02-12 15:44:36 +01:00
|
|
|
{{/*These templates contains some more complex logic and shared between partials*/}}
|
2019-02-20 10:37:48 +01:00
|
|
|
{{- define "title" -}}
|
2019-04-16 08:23:25 +02:00
|
|
|
{{- if and .File .Pages -}}
|
|
|
|
{{ $sections := split (trim .File.Dir "/") "/" }}
|
2018-09-17 18:29:36 +02:00
|
|
|
{{ $title := index ($sections | last 1) 0 | humanize | title }}
|
2018-09-18 01:35:54 +02:00
|
|
|
{{- default $title .Title -}}
|
2019-04-16 08:23:25 +02:00
|
|
|
{{- else if .File -}}
|
2018-09-17 18:29:36 +02:00
|
|
|
{{ $title := .File | humanize | title }}
|
2018-09-18 01:35:54 +02:00
|
|
|
{{- default $title .Title -}}
|
2018-09-17 18:29:36 +02:00
|
|
|
{{- end -}}
|
2019-02-20 10:37:48 +01:00
|
|
|
{{- end -}}
|
2019-02-13 23:31:13 +01:00
|
|
|
|
2019-02-20 10:37:48 +01:00
|
|
|
{{- define "hrefhack" -}}
|
2019-02-13 23:31:13 +01:00
|
|
|
{{ $attrEq := "$=" }}
|
|
|
|
{{ $attrVal := .RelPermalink }}
|
|
|
|
{{ if eq .RelPermalink "/" }}
|
|
|
|
{{ $attrEq = "=" }}
|
|
|
|
{{ $attrVal = .Permalink }}
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
<style>
|
|
|
|
nav ul a[href{{ $attrEq }}"{{ $attrVal }}"] {
|
|
|
|
color: {{ default "#004ed0" .Site.Params.BookMenuBundleActiveLinkColor }};
|
|
|
|
}
|
|
|
|
</style>
|
2019-02-20 10:37:48 +01:00
|
|
|
{{- end -}}
|
2019-02-20 00:28:16 +01:00
|
|
|
|
2019-02-20 10:37:48 +01:00
|
|
|
{{- define "jsmenu" -}}
|
2019-02-20 00:28:16 +01:00
|
|
|
<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>
|
2019-02-20 10:37:48 +01:00
|
|
|
{{- end -}}
|