From 46406fda64fd1a171ec68aa3a66d4d384d38249a Mon Sep 17 00:00:00 2001 From: loikein Date: Thu, 25 May 2023 12:03:42 +0100 Subject: [PATCH] update layouts: draft tag; remove redundant code --- layouts/book/all.html | 23 +++++++++-------------- layouts/book/chapters.html | 2 +- layouts/book/volumes.html | 17 +++++++++-------- layouts/index.html | 2 +- layouts/partials/content.header.html | 2 +- 5 files changed, 21 insertions(+), 25 deletions(-) diff --git a/layouts/book/all.html b/layouts/book/all.html index 83fd858..f5c8843 100644 --- a/layouts/book/all.html +++ b/layouts/book/all.html @@ -14,26 +14,21 @@
+{{- if .RegularPages -}} +{{- end -}} -{{ $indexScratch := .Scratch }} -{{ range .Sections }} -{{ $indexScratch.Add "sections" (slice . ) }} -{{ end }} - -{{- range ($indexScratch.Get "sections").ByTitle -}} -

{{ .Title }}{{- if .Draft -}} :: Draft {{- end -}}

+{{- range .Sections.ByTitle -}} +

{{ .Title }}{{- if .Draft -}} :: Draft{{- end -}}

{{- end -}} diff --git a/layouts/book/chapters.html b/layouts/book/chapters.html index 856d3da..42b105c 100644 --- a/layouts/book/chapters.html +++ b/layouts/book/chapters.html @@ -15,7 +15,7 @@ diff --git a/layouts/book/volumes.html b/layouts/book/volumes.html index a55499c..dc32104 100644 --- a/layouts/book/volumes.html +++ b/layouts/book/volumes.html @@ -15,23 +15,24 @@ +{{- if .RegularPages -}} +{{- end -}} +{{- if .Sections -}} +{{- end -}} +
{{ partial "footer.html" . }} diff --git a/layouts/index.html b/layouts/index.html index f851398..ba63012 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -15,7 +15,7 @@ {{ if .IsNode }} {{ .Title}} {{ else }} - {{ .Title }}{{ if .Draft }} :: Draft {{end}} + {{ .Title }}{{ if .Draft }} :: Draft{{end}} {{ end }} diff --git a/layouts/partials/content.header.html b/layouts/partials/content.header.html index b87811e..d31ebe7 100644 --- a/layouts/partials/content.header.html +++ b/layouts/partials/content.header.html @@ -1,6 +1,6 @@

-{{- .Title -}}{{- if .Draft -}} :: Draft {{- end -}} +{{- .Title -}}{{- if .Draft -}} :: Draft{{- end -}}

{{- if .Params.subtitle -}}

{{ .Params.subtitle }}