From 561659ed53a1eb1e7583513af5fa2faba55fca7e Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Mon, 17 Sep 2018 18:29:36 +0200 Subject: Improve page title handling and side menu templates --- layouts/docs/baseof.html | 4 +-- layouts/partials/docs/html-head.html | 1 + layouts/partials/docs/nav-filetree.html | 55 +++++++++++++++------------------ layouts/partials/docs/shared.html | 11 +++++++ 4 files changed, 39 insertions(+), 32 deletions(-) create mode 100644 layouts/partials/docs/shared.html (limited to 'layouts') diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html index a71bd59..4119888 100644 --- a/layouts/docs/baseof.html +++ b/layouts/docs/baseof.html @@ -1,9 +1,9 @@ + {{ partial "docs/html-head" . }} {{ partial "docs/inject/head" . }} - {{ block "title" . }} {{- .Site.Title -}} {{ end }} @@ -27,7 +27,7 @@
- {{ block "main" . }} {{- .Content -}} {{ end }} + {{- .Content -}}
{{ $showToC := default (default true .Site.Params.BookShowToC) .Params.bookshowtoc }} {{ if and ($showToC) (.Page.TableOfContents) }} diff --git a/layouts/partials/docs/html-head.html b/layouts/partials/docs/html-head.html index ecf8a4c..e77c218 100644 --- a/layouts/partials/docs/html-head.html +++ b/layouts/partials/docs/html-head.html @@ -1,5 +1,6 @@ +{{- template "title" . }} | {{ .Site.Title -}} diff --git a/layouts/partials/docs/nav-filetree.html b/layouts/partials/docs/nav-filetree.html index c5ecfc8..7c80ae2 100644 --- a/layouts/partials/docs/nav-filetree.html +++ b/layouts/partials/docs/nav-filetree.html @@ -1,15 +1,5 @@ -{{ $bookSection := default "docs" .Site.Params.BookSection }} -{{ if eq $bookSection "*" }} - {{ .Scratch.Set "BookSections" .Site.Sections }} -{{ else }} - {{ $bookSections := where .Site.Sections "Section" $bookSection }} - {{ .Scratch.Set "BookSections" $bookSections }} - - {{ if eq (len $bookSections) 1 }} - {{ $singleSection := index $bookSections 0 }} - {{ .Scratch.Set "BookSections" $singleSection.Sections }} - {{ end }} -{{ end }} + +{{ template "book-get-root-section" . }}