aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/docs/shared.html
diff options
context:
space:
mode:
authorAlex Shpak <alex-shpak@users.noreply.github.com>2019-04-22 19:17:39 +0200
committerAlex Shpak <alex-shpak@users.noreply.github.com>2019-04-22 19:17:39 +0200
commit0b30289d9f3520144bb37caa009d8953cde0e3d6 (patch)
tree0f9bb8c645db952484ae1d0d98f961142184c894 /layouts/partials/docs/shared.html
parent0084e069de16a7b6c15f50edd7479e2e49fe0874 (diff)
#43, Update tree menu rendering to support multiple sections
Diffstat (limited to 'layouts/partials/docs/shared.html')
-rw-r--r--layouts/partials/docs/shared.html25
1 files changed, 12 insertions, 13 deletions
diff --git a/layouts/partials/docs/shared.html b/layouts/partials/docs/shared.html
index 3fbf628..2678840 100644
--- a/layouts/partials/docs/shared.html
+++ b/layouts/partials/docs/shared.html
@@ -1,16 +1,16 @@
{{/*These templates contains some more complex logic and shared between partials*/}}
-{{- define "title" -}}
- {{- if and .File .Pages -}}
+{{ define "title" }}
+ {{ if and .File .Pages }}
{{ $sections := split (trim .File.Dir "/") "/" }}
{{ $title := index ($sections | last 1) 0 | humanize | title }}
- {{- default $title .Title -}}
- {{- else if .File -}}
- {{ $title := .File | humanize | title }}
- {{- default $title .Title -}}
- {{- end -}}
-{{- end -}}
+ {{ default $title .Title }}
+ {{ else if .File }}
+ {{ $title := .File.BaseFileName | humanize | title }}
+ {{ default $title .Title }}
+ {{ end }}
+{{ end }}
-{{- define "hrefhack" -}}
+{{ define "hrefhack" }}
{{ $attrEq := "$=" }}
{{ $attrVal := .RelPermalink }}
{{ if eq .RelPermalink "/" }}
@@ -23,17 +23,16 @@
color: {{ default "#004ed0" .Site.Params.BookMenuBundleActiveLinkColor }};
}
</style>
-{{- end -}}
+{{ end }}
-{{- define "jsmenu" -}}
+{{ 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 -}} \ No newline at end of file
+{{ end }} \ No newline at end of file