- {{ 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" . }}
{{ range .Scratch.Get "BookSections" }}
@@ -20,7 +10,15 @@
{{ define "book-section" }}
-
- {{ template "book-heading" .Section }}
+
+ {{ with .Section}}
+ {{- if .Content -}}
+ {{- template "title" . -}}
+ {{- else -}}
+ {{- template "title" . -}}
+ {{- end -}}
+ {{ end }}
+
{{ end }}
-
-{{ define "book-heading" }}
-
- {{ $sections := split (trim .Dir "/") "/" }}
- {{ $title := index ($sections | last 1) 0 | humanize | title }}
- {{ $title := default .Title $title }}
-
- {{ if .Content }}
-
- {{- $title -}}
-
+{{ define "book-get-root-section" }}
+
+ {{ $bookSection := default "docs" .Site.Params.BookSection }}
+ {{ if eq $bookSection "*" }}
+ {{ .Scratch.Set "BookSections" .Site.Sections }}
{{ else }}
-
- {{- $title -}}
-
- {{ end }}
+ {{ $bookSections := where .Site.Sections "Section" $bookSection }}
+ {{ .Scratch.Set "BookSections" $bookSections }}
-{{ end }}
+ {{ if eq (len $bookSections) 1 }}
+ {{ $singleSection := index $bookSections 0 }}
+ {{ .Scratch.Set "BookSections" $singleSection.Sections }}
+ {{ end }}
+ {{ end }}
+{{ end }}
\ No newline at end of file
diff --git a/layouts/partials/docs/shared.html b/layouts/partials/docs/shared.html
new file mode 100644
index 0000000..f7ba182
--- /dev/null
+++ b/layouts/partials/docs/shared.html
@@ -0,0 +1,11 @@
+
+{{ 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 }}