From 8b432c5207f2dede1f9923b86271aafedcd6c624 Mon Sep 17 00:00:00 2001 From: tdro Date: Thu, 1 Jun 2023 19:40:16 -0400 Subject: themes/default/layouts/partials/render-embed: Attempt reuse Format default layouts --- themes/default/layouts/_default/index.html | 31 +++--- .../default/layouts/_default/section.drafts.html | 32 +++--- themes/default/layouts/_default/section.feeds.html | 32 +++--- themes/default/layouts/_default/section.html | 32 +++--- themes/default/layouts/_default/section.likes.html | 2 +- themes/default/layouts/_default/section.media.html | 54 +++++---- themes/default/layouts/_default/single.embed.html | 3 +- themes/default/layouts/_default/single.html | 124 ++++++++++----------- themes/default/layouts/_default/term.html | 26 ++--- themes/default/layouts/partials/base-embed.html | 4 + themes/default/layouts/partials/render-embed.html | 22 ++++ 11 files changed, 186 insertions(+), 176 deletions(-) create mode 100644 themes/default/layouts/partials/base-embed.html create mode 100644 themes/default/layouts/partials/render-embed.html diff --git a/themes/default/layouts/_default/index.html b/themes/default/layouts/_default/index.html index 5e78371..ed8faca 100644 --- a/themes/default/layouts/_default/index.html +++ b/themes/default/layouts/_default/index.html @@ -1,11 +1,10 @@ -{{ define "styles" }} +{{- define "styles" -}} -{{ end }} - -{{ define "middle" }} +{{- end -}} +{{- define "middle" -}} {{- partial "navigator-middle.html" (dict "Context" . @@ -18,24 +17,22 @@ ) -}} - {{ range .Paginator.Pages }} - {{ .Render "summary" }} - {{ end }} - - {{ partial "pagination.html" . }} + {{- range .Paginator.Pages -}} + {{- partial "render-embed.html" . -}} + {{- end -}} -{{ end }} + {{- partial "pagination.html" . -}} +{{- end -}} -{{ define "right" }} +{{- define "right" -}} {{- partial "author-list.html" . -}} - {{ range first 1 (where .Site.Pages "Params.Author" .Site.Author.default.gallery) }} + {{- range first 1 (where .Site.Pages "Params.Author" .Site.Author.default.gallery) -}} {{- partial "gallery.html" . -}} - {{ end }} + {{- end -}} - {{ range first 1 (where .Site.Pages "Params.Author" .Site.Author.default.webring) }} + {{- range first 1 (where .Site.Pages "Params.Author" .Site.Author.default.webring) -}} {{- partial "following-list.html" . -}} {{- partial "webring.html" . -}} - {{ end }} - -{{ end }} + {{- end -}} +{{- end -}} diff --git a/themes/default/layouts/_default/section.drafts.html b/themes/default/layouts/_default/section.drafts.html index ad862c4..b582893 100644 --- a/themes/default/layouts/_default/section.drafts.html +++ b/themes/default/layouts/_default/section.drafts.html @@ -1,4 +1,4 @@ -{{ define "styles" }} +{{- define "styles" -}} {{- $author := partial "function-authors-data.html" . -}} {{- $author = $author.user -}} -{{ end }} +{{- end -}} -{{ define "middle" }} - - {{ partial "navigator-middle.html" +{{- define "middle" -}} + {{- partial "navigator-middle.html" (dict "Title" "Drafts" "Subtitle" (partial "count-drafts.html" .) @@ -28,29 +27,28 @@ "Id" "back" "Context" . ) - }} + -}} - {{ partial "profile.html" . }} + {{- partial "profile.html" . -}} {{- $author := partial "function-authors-data.html" . -}} {{- $author = $author.user -}} {{- $users := where .Site.RegularPages "Section" $author -}} {{- $drafts := where .Site.RegularPages "Draft" true -}} {{- $filteredPages := $users | intersect $drafts -}} - {{- $paginator := .Paginate $filteredPages }} + {{- $paginator := .Paginate $filteredPages -}} - {{ range $paginator.Pages }} - {{ .Render "summary" }} - {{ else }} + {{- range $paginator.Pages -}} + {{- partial "render-embed.html" . -}} + {{- else -}} - {{ end }} - - {{ partial "pagination.html" . }} + {{- end -}} -{{ end }} + {{- partial "pagination.html" . -}} +{{- end -}} -{{ define "right" }} +{{- define "right" -}} {{- partial "navigator-right.html" . -}} -{{ end }} +{{- end -}} diff --git a/themes/default/layouts/_default/section.feeds.html b/themes/default/layouts/_default/section.feeds.html index f315c32..be65683 100644 --- a/themes/default/layouts/_default/section.feeds.html +++ b/themes/default/layouts/_default/section.feeds.html @@ -1,4 +1,4 @@ -{{ define "styles" }} +{{- define "styles" -}} {{- $author := partial "function-authors-data.html" . -}} {{- $author = $author.user -}} -{{ end }} +{{- end -}} -{{ define "middle" }} - - {{ partial "navigator-middle.html" +{{- define "middle" -}} + {{- partial "navigator-middle.html" (dict "Context" . "IconLabel" "Back" @@ -28,24 +27,23 @@ "Subtitle" (partial "count-feeds.html" .) "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/") ) - }} + -}} - {{ partial "profile.html" . }} + {{- partial "profile.html" . -}} - {{ range .Paginator.Pages }} - {{ .Render "summary" }} - {{ else }} + {{- range .Paginator.Pages -}} + {{- partial "render-embed.html" . -}} + {{- else -}} - {{ end }} - - {{ partial "pagination.html" . }} + {{- end -}} - {{ $writeToFile := partial "function-generate-feeds" . }} + {{- partial "pagination.html" . -}} -{{ end }} + {{- $writeToFile := partial "function-generate-feeds" . -}} +{{- end -}} -{{ define "right" }} +{{- define "right" -}} {{- partial "navigator-right.html" . -}} -{{ end }} +{{- end -}} diff --git a/themes/default/layouts/_default/section.html b/themes/default/layouts/_default/section.html index d678039..fc3ba74 100644 --- a/themes/default/layouts/_default/section.html +++ b/themes/default/layouts/_default/section.html @@ -1,4 +1,4 @@ -{{ define "styles" }} +{{- define "styles" -}} -{{ end }} - -{{ define "middle" }} +{{- end -}} +{{- define "middle" -}} {{- $author := partial "function-authors-data.html" . -}} - {{ partial "navigator-middle.html" + {{- partial "navigator-middle.html" (dict "Context" . "IconLabel" "Back" @@ -29,24 +28,23 @@ "Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/") "Subtitle" (print (lang.FormatNumberCustom 0 .Paginator.TotalNumberOfElements) " " "Messages") ) - }} + -}} - {{ partial "author-section-picture.html" . }} + {{- partial "author-section-picture.html" . -}} - {{ partial "profile.html" . }} + {{- partial "profile.html" . -}} - {{ range .Paginator.Pages }} - {{ .Render "summary" }} - {{ else }} + {{- range .Paginator.Pages -}} + {{- partial "render-embed.html" . -}} + {{- else -}} - {{ end }} - - {{ partial "pagination.html" . }} + {{- end -}} -{{ end }} + {{- partial "pagination.html" . -}} +{{- end -}} -{{ define "right" }} +{{- define "right" -}} {{- partial "navigator-right.html" . -}} -{{ end }} +{{- end -}} diff --git a/themes/default/layouts/_default/section.likes.html b/themes/default/layouts/_default/section.likes.html index 201c0a5..311cbbb 100644 --- a/themes/default/layouts/_default/section.likes.html +++ b/themes/default/layouts/_default/section.likes.html @@ -39,7 +39,7 @@ {{- partial "profile.html" . -}} {{- range $paginator.Pages -}} - {{- .Render "summary" -}} + {{- partial "render-embed.html" . -}} {{- else -}}