From 31c9c77c5e3d89c0ff26d91a857240742a39e97a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Mon, 11 Apr 2022 23:04:49 +0200 Subject: [PATCH] print: DRY partials #230 --- layouts/_default/list.html | 4 +-- layouts/_default/list.print.html | 4 +-- layouts/_default/single.html | 4 +-- layouts/_default/single.print.html | 4 +-- layouts/_default/taxonomy.html | 23 +---------------- layouts/_default/taxonomy.print.html | 23 +---------------- layouts/index.html | 22 +--------------- layouts/index.print.html | 22 +--------------- layouts/partials/_index.html | 25 +++++++++++++++++++ layouts/partials/_list.html | 7 ++++++ layouts/partials/_single.html | 7 ++++++ layouts/partials/_taxonomy.html | 22 ++++++++++++++++ .../{content-screen.html => body.html} | 0 .../{content-print.html => body.print.html} | 0 14 files changed, 69 insertions(+), 98 deletions(-) create mode 100644 layouts/partials/_index.html create mode 100644 layouts/partials/_list.html create mode 100644 layouts/partials/_single.html create mode 100644 layouts/partials/_taxonomy.html rename layouts/partials/{content-screen.html => body.html} (100%) rename layouts/partials/{content-print.html => body.print.html} (100%) diff --git a/layouts/_default/list.html b/layouts/_default/list.html index d93ea31852..7a50069c46 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,4 +1,2 @@ {{- .Scratch.Set "relearnOutputFormat" "HTML" }} -{{- partial "header.html" . }} -{{- partial "content-screen.html" . }} -{{- partial "footer.html" . }} \ No newline at end of file +{{- partial "_list.html" . }} \ No newline at end of file diff --git a/layouts/_default/list.print.html b/layouts/_default/list.print.html index 4c2b2ac9e0..eac72a3b86 100644 --- a/layouts/_default/list.print.html +++ b/layouts/_default/list.print.html @@ -1,4 +1,2 @@ {{- .Scratch.Set "relearnOutputFormat" "PRINT" }} -{{- partial "header.html" . }} -{{- partial "content-print.html" . }} -{{- partial "footer.html" . }} \ No newline at end of file +{{- partial "_list.html" . }} \ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d93ea31852..d792465bfc 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,4 +1,2 @@ {{- .Scratch.Set "relearnOutputFormat" "HTML" }} -{{- partial "header.html" . }} -{{- partial "content-screen.html" . }} -{{- partial "footer.html" . }} \ No newline at end of file +{{- partial "_single.html" . }} \ No newline at end of file diff --git a/layouts/_default/single.print.html b/layouts/_default/single.print.html index 4c2b2ac9e0..9403344056 100644 --- a/layouts/_default/single.print.html +++ b/layouts/_default/single.print.html @@ -1,4 +1,2 @@ {{- .Scratch.Set "relearnOutputFormat" "PRINT" }} -{{- partial "header.html" . }} -{{- partial "content-print.html" . }} -{{- partial "footer.html" . }} \ No newline at end of file +{{- partial "_single.html" . }} \ No newline at end of file diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index 8a1a940af8..fb0e02a177 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -1,23 +1,2 @@ {{- .Scratch.Set "relearnOutputFormat" "HTML" }} -{{- partial "header.html" . }} -
- -

{{ if eq .Kind "term" }}{{ .Data.Singular | humanize }} {{ default "::" .Site.Params.titleSeparator }} {{ end }}{{ .Title }}

- - -
-
-
-{{- partial "footer.html" . }} \ No newline at end of file +{{- partial "_taxonomy.html" . }} \ No newline at end of file diff --git a/layouts/_default/taxonomy.print.html b/layouts/_default/taxonomy.print.html index f747eea81f..9c47723966 100644 --- a/layouts/_default/taxonomy.print.html +++ b/layouts/_default/taxonomy.print.html @@ -1,23 +1,2 @@ {{- .Scratch.Set "relearnOutputFormat" "PRINT" }} -{{- partial "header.html" . }} -
- -

{{ if eq .Kind "term" }}{{ .Data.Singular | humanize }} {{ default "::" .Site.Params.titleSeparator }} {{ end }}{{ .Title }}

- - -
-
-
-{{- partial "footer.html" . }} \ No newline at end of file +{{- partial "_taxonomy.html" . }} \ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html index e6c1830cd8..8eae7b7a35 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,22 +1,2 @@ {{- .Scratch.Set "relearnOutputFormat" "HTML" }} -{{- partial "header.html" . }} -{{- if .Site.Home.Content }} - {{- partial "content-screen.html" .Site.Home }} -{{- else }} -
- -

Customize your own home page

-

- The site is working. Don't forget to customize this page with your own. You typically have 3 choices : -

- - -
-
-
-{{- end }} -{{- partial "footer.html" . }} \ No newline at end of file +{{- partial "_index.html" . }} \ No newline at end of file diff --git a/layouts/index.print.html b/layouts/index.print.html index a04c5856a8..6d7193eb94 100644 --- a/layouts/index.print.html +++ b/layouts/index.print.html @@ -1,22 +1,2 @@ {{- .Scratch.Set "relearnOutputFormat" "PRINT" }} -{{- partial "header.html" . }} -{{- if .Site.Home.Content }} - {{- partial "content-print.html" .Site.Home }} -{{- else }} -
- -

Customize your own home page

-

- The site is working. Don't forget to customize this page with your own. You typically have 3 choices : -

- - -
-
-
-{{- end }} -{{- partial "footer.html" . }} \ No newline at end of file +{{- partial "_index.html" . }} \ No newline at end of file diff --git a/layouts/partials/_index.html b/layouts/partials/_index.html new file mode 100644 index 0000000000..8250488442 --- /dev/null +++ b/layouts/partials/_index.html @@ -0,0 +1,25 @@ +{{- partial "header.html" . }} +{{- if .Site.Home.Content }} + {{- if eq (.Scratch.Get "relearnOutputFormat") "PRINT" }} + {{- partial "body.print.html" .Site.Home }} + {{- else }} + {{- partial "body.html" .Site.Home }} + {{- end }} +{{- else }} +
+ +

Customize your own home page

+

+ The site is working. Don't forget to customize this page with your own. You typically have 3 choices : +

+ + +
+
+
+{{- end }} +{{- partial "footer.html" . }} \ No newline at end of file diff --git a/layouts/partials/_list.html b/layouts/partials/_list.html new file mode 100644 index 0000000000..3f7b1dfb5b --- /dev/null +++ b/layouts/partials/_list.html @@ -0,0 +1,7 @@ +{{- partial "header.html" . }} +{{- if eq (.Scratch.Get "relearnOutputFormat") "PRINT" }} + {{- partial "body.print.html" . }} +{{- else }} + {{- partial "body.html" . }} +{{- end }} +{{- partial "footer.html" . }} \ No newline at end of file diff --git a/layouts/partials/_single.html b/layouts/partials/_single.html new file mode 100644 index 0000000000..3f7b1dfb5b --- /dev/null +++ b/layouts/partials/_single.html @@ -0,0 +1,7 @@ +{{- partial "header.html" . }} +{{- if eq (.Scratch.Get "relearnOutputFormat") "PRINT" }} + {{- partial "body.print.html" . }} +{{- else }} + {{- partial "body.html" . }} +{{- end }} +{{- partial "footer.html" . }} \ No newline at end of file diff --git a/layouts/partials/_taxonomy.html b/layouts/partials/_taxonomy.html new file mode 100644 index 0000000000..7bdf074b7f --- /dev/null +++ b/layouts/partials/_taxonomy.html @@ -0,0 +1,22 @@ +{{- partial "header.html" . }} +
+ +

{{ if eq .Kind "term" }}{{ .Data.Singular | humanize }} {{ default "::" .Site.Params.titleSeparator }} {{ end }}{{ .Title }}

+ + + +
+{{- partial "footer.html" . }} \ No newline at end of file diff --git a/layouts/partials/content-screen.html b/layouts/partials/body.html similarity index 100% rename from layouts/partials/content-screen.html rename to layouts/partials/body.html diff --git a/layouts/partials/content-print.html b/layouts/partials/body.print.html similarity index 100% rename from layouts/partials/content-print.html rename to layouts/partials/body.print.html