aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2023-06-01 19:40:16 -0400
committertdro <tdro@noreply.example.com>2023-06-01 19:40:16 -0400
commit8b432c5207f2dede1f9923b86271aafedcd6c624 (patch)
tree7ec8c107a890853473f7d153f3d0461e263c1139
parent8720c0f92fa3f37864ea2d0db11502204f60832f (diff)
downloadcanory-8b432c5207f2dede1f9923b86271aafedcd6c624.tar.gz
canory-8b432c5207f2dede1f9923b86271aafedcd6c624.tar.bz2
canory-8b432c5207f2dede1f9923b86271aafedcd6c624.zip
themes/default/layouts/partials/render-embed: Attempt reuse
Format default layouts
-rw-r--r--themes/default/layouts/_default/index.html31
-rw-r--r--themes/default/layouts/_default/section.drafts.html32
-rw-r--r--themes/default/layouts/_default/section.feeds.html32
-rw-r--r--themes/default/layouts/_default/section.html32
-rw-r--r--themes/default/layouts/_default/section.likes.html2
-rw-r--r--themes/default/layouts/_default/section.media.html54
-rw-r--r--themes/default/layouts/_default/single.embed.html3
-rw-r--r--themes/default/layouts/_default/single.html124
-rw-r--r--themes/default/layouts/_default/term.html26
-rw-r--r--themes/default/layouts/partials/base-embed.html4
-rw-r--r--themes/default/layouts/partials/render-embed.html22
11 files changed, 186 insertions, 176 deletions
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" -}}
<style>
{{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }}
</style>
-{{ 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 -}}
<style>
@@ -14,11 +14,10 @@
text-decoration: underline;
}
</style>
-{{ 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 -}}
<footer>
<code>No drafts found!</code>
</footer>
- {{ 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 -}}
<style>
@@ -14,11 +14,10 @@
text-decoration: underline;
}
</style>
-{{ 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 -}}
<footer>
<code>No feeds found!</code>
</footer>
- {{ 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" -}}
<style>
{{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }}
@@ -13,13 +13,12 @@
text-decoration: underline;
}
</style>
-{{ 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 -}}
<footer>
<code>No messages found!</code>
</footer>
- {{ 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 -}}
<footer>
<code>No likes found!</code>
diff --git a/themes/default/layouts/_default/section.media.html b/themes/default/layouts/_default/section.media.html
index 9191a3e..420035b 100644
--- a/themes/default/layouts/_default/section.media.html
+++ b/themes/default/layouts/_default/section.media.html
@@ -1,4 +1,4 @@
-{{ define "styles" }}
+{{- define "styles" -}}
{{- $author := partial "function-authors-data.html" . -}}
{{- $author = $author.user -}}
<style>
@@ -14,11 +14,10 @@
text-decoration: underline;
}
</style>
-{{ end }}
+{{- end -}}
-{{ define "middle" }}
-
- {{ partial "navigator-middle.html"
+{{- define "middle" -}}
+ {{- partial "navigator-middle.html"
(dict
"Title" "Media"
"Subtitle" (partial "count-media.html" .)
@@ -28,43 +27,42 @@
"Id" "back"
"Context" .
)
- }}
+ -}}
- {{ partial "profile.html" . }}
+ {{- partial "profile.html" . -}}
{{- $author := partial "function-authors-data.html" . -}}
{{- $author = $author.user -}}
- {{ $count := 0 }}
- {{ $result := false }}
+ {{- $count := 0 -}}
+ {{- $result := false -}}
- {{ range .Site.RegularPages }}
- {{ if or
+ {{- range .Site.RegularPages -}}
+ {{- if or
(in .Content "<figure>")
(in .Content "<imgur-video>")
(in .Content "<youtube-video>")
(in .Content "<video-container>")
- }}
- {{ if eq .Type $author }}
- {{ $result = true }}
- {{ $count = add $count 1 }}
- {{ if le $count 10 }}
- {{ .Render "summary" }}
- {{ end }}
- {{ end }}
- {{ end }}
- {{ end }}
+ -}}
+ {{- if eq .Type $author -}}
+ {{- $result = true -}}
+ {{- $count = add $count 1 -}}
+ {{- if le $count 10 -}}
+ {{- partial "render-embed.html" . -}}
+ {{- end -}}
+ {{- end -}}
+ {{- end -}}
+ {{- end -}}
- {{ if not $result }}
+ {{- if not $result -}}
<footer>
<code>No media found!</code>
</footer>
- {{ 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/single.embed.html b/themes/default/layouts/_default/single.embed.html
index f44c9e9..66ea9c8 100644
--- a/themes/default/layouts/_default/single.embed.html
+++ b/themes/default/layouts/_default/single.embed.html
@@ -1,3 +1,2 @@
-{{- partial "base-css.html" . -}}
-
+{{- partial "base-embed.html" . -}}
{{- .Render "summary" -}}
diff --git a/themes/default/layouts/_default/single.html b/themes/default/layouts/_default/single.html
index 9aeb728..8a6444d 100644
--- a/themes/default/layouts/_default/single.html
+++ b/themes/default/layouts/_default/single.html
@@ -5,79 +5,77 @@
{{- end -}}
{{- define "middle" -}}
+ {{- partial "navigator-middle.html"
+ (dict
+ "Title" "Message"
+ "Subtitle" "Thread"
+ "Icon" "arrow-left"
+ "IconLabel" "Back"
+ "Href" "/"
+ "Id" "back"
+ "Context" .
+ )
+ -}}
-{{- partial "navigator-middle.html"
- (dict
- "Title" "Message"
- "Subtitle" "Thread"
- "Icon" "arrow-left"
- "IconLabel" "Back"
- "Href" "/"
- "Id" "back"
- "Context" .
- )
--}}
+ <micro-thread>
+ {{- partial "render-embed.html" . -}}
-<micro-thread>
- {{ .Render "summary" }}
+ {{- $nextHref := "" -}}
+ {{- $prevHref := "" -}}
+ {{- $nextTitle := "" -}}
+ {{- $prevTitle := "" -}}
+ {{- $nextInvisible := "data-invisible" -}}
+ {{- $prevInvisible := "data-invisible" -}}
- {{- $nextHref := "" -}}
- {{- $prevHref := "" -}}
- {{- $nextTitle := "" -}}
- {{- $prevTitle := "" -}}
- {{- $nextInvisible := "data-invisible" -}}
- {{- $prevInvisible := "data-invisible" -}}
+ {{- with .Next -}}
+ {{- $nextHref = $.Next.Permalink -}}
+ {{- $nextTitle = $.Next.Summary -}}
+ {{- $nextInvisible = "" -}}
+ {{- end -}}
- {{- with .Next -}}
- {{- $nextHref = $.Next.Permalink -}}
- {{- $nextTitle = $.Next.Summary -}}
- {{- $nextInvisible = "" -}}
- {{- end -}}
+ {{- with .Prev -}}
+ {{- $prevHref = $.Prev.Permalink -}}
+ {{- $prevTitle = $.Prev.Summary -}}
+ {{- $prevInvisible = "" -}}
+ {{- end -}}
- {{- with .Prev -}}
- {{- $prevHref = $.Prev.Permalink -}}
- {{- $prevTitle = $.Prev.Summary -}}
- {{- $prevInvisible = "" -}}
- {{- end -}}
+ {{- with or .Next .Prev -}}
+ <paginator-navigation>
+ <a {{ $nextInvisible | safeHTMLAttr }} href="{{ $nextHref }}" title="{{ $nextTitle }}">
+ {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-left.svg")) }}
+ Newer
+ </a>
- {{- with or .Next .Prev -}}
- <paginator-navigation>
- <a {{ $nextInvisible | safeHTMLAttr }} href="{{ $nextHref }}" title="{{ $nextTitle }}">
- {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-left.svg")) }}
- Newer
- </a>
+ <a {{ $prevInvisible | safeHTMLAttr }} href="{{ $prevHref }}" title="{{ $prevTitle }}">
+ Older
+ {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-right.svg")) }}
+ </a>
+ </paginator-navigation>
+ {{- end -}}
- <a {{ $prevInvisible | safeHTMLAttr }} href="{{ $prevHref }}" title="{{ $prevTitle }}">
- Older
- {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-right.svg")) }}
- </a>
- </paginator-navigation>
- {{- end -}}
+ {{- $filteredPages := partial "function-filters-content.html" (.Site.RegularPages.Related .) -}}
+ {{- $related := $filteredPages | first 3 -}}
- {{- $filteredPages := partial "function-filters-content.html" (.Site.RegularPages.Related .) -}}
- {{- $related := $filteredPages | first 3 -}}
-
- {{- with $related -}}
- <related-content>
- <footer>
- <samp>
- Related Tags
- {{- with $.Params.tags -}}
- {{- range $tag := first 1 $.Params.tags -}}
- {{- $link := print ("tags/" | relURL) ($tag | urlize) "/" }}
- {{ print "---" " " "[#" $tag "](" $link ")" | markdownify -}}
+ {{- with $related -}}
+ <related-content>
+ <footer>
+ <samp>
+ Related Tags
+ {{- with $.Params.tags -}}
+ {{- range $tag := first 1 $.Params.tags -}}
+ {{- $link := print ("tags/" | relURL) ($tag | urlize) "/" }}
+ {{ print "---" " " "[#" $tag "](" $link ")" | markdownify -}}
+ {{- end -}}
{{- end -}}
- {{- end -}}
- </samp>
- </footer>
- </related-content>
-
- {{- range $related -}}
- {{- .Render "summary" -}}
- {{- end -}}
- {{- end -}}
+ </samp>
+ </footer>
+ </related-content>
-</micro-thread>
+ {{- range $related -}}
+ {{- partial "render-embed.html" . -}}
+ {{- end -}}
+ {{- end -}}
+ </micro-thread>
{{- end -}}
{{- define "right" -}}
diff --git a/themes/default/layouts/_default/term.html b/themes/default/layouts/_default/term.html
index 0371a9e..7451e10 100644
--- a/themes/default/layouts/_default/term.html
+++ b/themes/default/layouts/_default/term.html
@@ -1,12 +1,11 @@
-{{ define "styles" }}
+{{- define "styles" -}}
<style>
{{ partial "styles-navigator.html" (dict "Link" "/tags/") | safeCSS }}
</style>
-{{ end }}
+{{- end -}}
-{{ define "middle" }}
-
- {{ partial "navigator-middle.html"
+{{- define "middle" -}}
+ {{- partial "navigator-middle.html"
(dict
"Context" .
"IconLabel" "Back"
@@ -16,16 +15,15 @@
"Subtitle" (print (lang.FormatNumberCustom 0 (len .Data.Pages)) " " "Messages")
"Href" (or (and (gt .Paginator.PageNumber 1) (.Paginator.Prev.URL | absURL)) "/")
)
- }}
-
- {{ 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 "navigator-right.html" . -}}
-{{ end }}
+{{- end -}}
diff --git a/themes/default/layouts/partials/base-embed.html b/themes/default/layouts/partials/base-embed.html
new file mode 100644
index 0000000..c6f3174
--- /dev/null
+++ b/themes/default/layouts/partials/base-embed.html
@@ -0,0 +1,4 @@
+<head>
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ {{- partial "base-css.html" . -}}
+</head>
diff --git a/themes/default/layouts/partials/render-embed.html b/themes/default/layouts/partials/render-embed.html
new file mode 100644
index 0000000..68bb370
--- /dev/null
+++ b/themes/default/layouts/partials/render-embed.html
@@ -0,0 +1,22 @@
+{{- $pageContext := . -}}
+
+{{- $page := print "public/" (strings.TrimPrefix
+ $pageContext.Page.Site.BaseURL
+ $pageContext.Page.Permalink
+ ) "embed.html"
+-}}
+
+{{- $modified := partial "function-page-modified.html" $pageContext -}}
+
+{{- if $modified -}}
+ {{- $pageContext.Render "summary" -}}
+{{- else -}}
+ {{- with $embed := resources.Get $page -}}
+ {{- $embedContent := strings.TrimPrefix (partial "base-embed.html" $pageContext) $embed.Content -}}
+ {{- if (in $embedContent "/data/media/404.png") -}}
+ {{- $pageContext.Render "summary" -}}
+ {{- else -}}
+ {{- $embedContent | safeHTML -}}
+ {{- end -}}
+ {{- end -}}
+{{- end -}}