From 8096748c7ddee3060a5f5a052f06aa5efa7b5482 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Sat, 2 Sep 2017 15:17:48 +0100 Subject: [PATCH] Move to base templates and blocks As opposed to the old way of including header/footer partials in every template. For some reason, /themes//layouts/taxonomies/tag.terms.html doesn't work as a block but the default terms template /themes//layouts/_default/terms.html does. --- layouts/_default/baseof.html | 4 ++++ layouts/_default/list.html | 13 +++++++------ layouts/_default/single.html | 5 +++-- layouts/_default/terms.html | 9 +++++++++ layouts/aside/single.html | 12 ++++++------ layouts/image/single.html | 8 ++++---- layouts/index.html | 4 ++-- layouts/post/single.html | 16 +++++++--------- layouts/quote/single.html | 8 ++++---- layouts/taxonomy/tag.terms.html | 8 -------- layouts/video/single.html | 10 +++++----- 11 files changed, 51 insertions(+), 46 deletions(-) create mode 100644 layouts/_default/baseof.html create mode 100644 layouts/_default/terms.html delete mode 100644 layouts/taxonomy/tag.terms.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..0fba350 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,4 @@ +{{ partial "header" . }} + {{ block "main" . }} + {{ end }} +{{ partial "footer" . }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index adb7a9a..163cf44 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,7 +1,8 @@ -{{ partial "header" . }} -

{{ .Title }}

-{{ range .Paginator.Pages }} -{{ .Render "li" }} +{{ define "main" }} +

{{ .Title }}

+ {{ range .Paginator.Pages }} + {{ .Render "li" }} + {{ end }} + {{ template "_internal/pagination.html" . }} {{ end }} -{{ template "_internal/pagination.html" . }} -{{ partial "footer" . }} + diff --git a/layouts/_default/single.html b/layouts/_default/single.html index ec8d538..e0e8308 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,2 +1,3 @@ -

Default single template

-{{ .Content }} +{{ define "main" }} + {{ .Content }} +{{ end }} diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html new file mode 100644 index 0000000..fce9e17 --- /dev/null +++ b/layouts/_default/terms.html @@ -0,0 +1,9 @@ +{{ define "main" }} +

Default taxonomy terms template

+

{{ .Title }}

+ +{{ end }} diff --git a/layouts/aside/single.html b/layouts/aside/single.html index 6d4dead..a57e02f 100644 --- a/layouts/aside/single.html +++ b/layouts/aside/single.html @@ -1,6 +1,6 @@ -{{ partial "header" . }} -
- {{ .Content }} -
-{{ partial "postmeta" . }} -{{ partial "footer" . }} +{{ define "main" }} +
+ {{ .Content }} +
+ {{ partial "postmeta" . }} +{{ end }} diff --git a/layouts/image/single.html b/layouts/image/single.html index 51dcad3..cbdcba1 100644 --- a/layouts/image/single.html +++ b/layouts/image/single.html @@ -1,4 +1,4 @@ -{{ partial "header" . }} -{{ partial "image" . }} -{{ partial "postmeta" . }} -{{ partial "footer" . }} +{{ define "main" }} + {{ partial "image" . }} + {{ partial "postmeta" . }} +{{ end }} diff --git a/layouts/index.html b/layouts/index.html index 40c37a2..a7ac75c 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,6 +1,6 @@ -{{ partial "header" . }} +{{ define "main" }} {{ range .Paginator.Pages }} {{ .Render "li" }} {{ end }} {{ template "_internal/pagination.html" . }} -{{ partial "footer" . }} +{{ end }} diff --git a/layouts/post/single.html b/layouts/post/single.html index 4d496a7..d0ed79c 100644 --- a/layouts/post/single.html +++ b/layouts/post/single.html @@ -1,9 +1,7 @@ -{{ partial "header" . }} - -
-

{{ .Title }}

- {{ .Content }} -
- -{{ partial "postmeta" . }} -{{ partial "footer" . }} \ No newline at end of file +{{ define "main" }} +
+

{{ .Title }}

+ {{ .Content }} +
+ {{ partial "postmeta" . }} +{{ end }} diff --git a/layouts/quote/single.html b/layouts/quote/single.html index e870163..5429e24 100644 --- a/layouts/quote/single.html +++ b/layouts/quote/single.html @@ -1,4 +1,4 @@ -{{ partial "header" . }} -{{ partial "quote" . }} -{{ partial "postmeta" . }} -{{ partial "footer" . }} +{{ define "main" }} + {{ partial "quote" . }} + {{ partial "postmeta" . }} +{{ end }} diff --git a/layouts/taxonomy/tag.terms.html b/layouts/taxonomy/tag.terms.html deleted file mode 100644 index e9ce8d5..0000000 --- a/layouts/taxonomy/tag.terms.html +++ /dev/null @@ -1,8 +0,0 @@ -{{ partial "header" . }} -

{{ .Title }}

- -{{ partial "footer" . }} diff --git a/layouts/video/single.html b/layouts/video/single.html index 2513fc2..9ecfb57 100644 --- a/layouts/video/single.html +++ b/layouts/video/single.html @@ -1,5 +1,5 @@ -{{ partial "header" . }} -{{ partial "video-embed" .Params.embed_url }} -{{ .Content }} -{{ partial "postmeta" . }} -{{ partial "footer" . }} +{{ define "main" }} + {{ partial "video-embed" .Params.embed_url }} + {{ .Content }} + {{ partial "postmeta" . }} +{{ end }}