From 9ef1d4b721f79bb7572fbfe422e7d3bf18c9939e Mon Sep 17 00:00:00 2001 From: loikein Date: Tue, 25 Apr 2023 15:19:09 +0100 Subject: [PATCH] update some layouts --- layouts/book/all.html | 4 +-- layouts/book/chapters.html | 8 +++++- layouts/book/volumes.html | 8 +++++- layouts/index.html | 9 +++---- layouts/partials/content.header.html | 39 +++++++++++++--------------- 5 files changed, 38 insertions(+), 30 deletions(-) diff --git a/layouts/book/all.html b/layouts/book/all.html index 2e81a33..616c6aa 100644 --- a/layouts/book/all.html +++ b/layouts/book/all.html @@ -19,10 +19,10 @@ {{ end }} {{- range ($indexScratch.Get "sections").ByTitle -}} -

{{ .Title }}

+

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

{{- end -}} diff --git a/layouts/book/chapters.html b/layouts/book/chapters.html index 7a74400..c83bf80 100644 --- a/layouts/book/chapters.html +++ b/layouts/book/chapters.html @@ -7,11 +7,17 @@ {{ partial "content.header.html" . }} +{{ with .Content }} +
+{{ . }} +
+{{ end }} +
diff --git a/layouts/book/volumes.html b/layouts/book/volumes.html index a401f27..d714c2b 100644 --- a/layouts/book/volumes.html +++ b/layouts/book/volumes.html @@ -7,11 +7,17 @@ {{ partial "content.header.html" . }} +{{ with .Content }} +
+{{ . }} +
+{{ end }} +
diff --git a/layouts/index.html b/layouts/index.html index 9c07738..08414c3 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -7,9 +7,10 @@
{{ end }}
-{{ range (.Paginate .Site.RegularPages).Pages }} -{{/* range where .Site.RegularPages "Type" "posts" */}} -{{ if ne .Draft true}} +{{ $pgFilter1 := where .Site.RegularPages "Draft" false }} +{{ $pgFilter2 := where .Site.RegularPages "Params.date" "!=" nil }} +{{ $pgFilter := $pgFilter1 | intersect $pgFilter2 }} +{{ range (.Paginate $pgFilter).Pages }}

{{ if .IsNode }} {{ .Title}} @@ -23,8 +24,6 @@ {{ else }}

{{ truncate 140 .Summary }}

{{ end }} - -{{ end }} {{ end }}

diff --git a/layouts/partials/content.header.html b/layouts/partials/content.header.html index e20e82f..b87811e 100644 --- a/layouts/partials/content.header.html +++ b/layouts/partials/content.header.html @@ -2,30 +2,27 @@

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

+{{- if .Params.subtitle -}} +

{{ .Params.subtitle }}

+{{- end -}} -{{- if .IsPage -}} - {{- if .Params.subtitle -}} -

{{ .Params.subtitle }}

+{{- if and (.IsPage) (.Params.meta) -}} + {{- end -}}