diff options
author | tdro <tdro@noreply.example.com> | 2022-07-10 05:40:39 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-07-10 05:40:39 -0400 |
commit | 4c028d71711aa50c112d05d10e31ab62359dda5d (patch) | |
tree | 88e6ee509b56b9ce12db9b0b19cddbfc8333716b | |
parent | 28f63d959f5c0c6ff5282a4c25e5da6f11435c8a (diff) | |
download | canory-4c028d71711aa50c112d05d10e31ab62359dda5d.tar.gz canory-4c028d71711aa50c112d05d10e31ab62359dda5d.tar.bz2 canory-4c028d71711aa50c112d05d10e31ab62359dda5d.zip |
themes/default/layouts/partials/function-content: Collect content
Ensure that content is congruent across all output types.
Set default state for when content is empty.
-rw-r--r-- | assets/css/default.css | 2 | ||||
-rw-r--r-- | themes/default/layouts/_default/rss.xml | 2 | ||||
-rw-r--r-- | themes/default/layouts/_default/summary.html | 7 | ||||
-rw-r--r-- | themes/default/layouts/partials/function-content.html | 14 | ||||
-rw-r--r-- | themes/default/layouts/partials/function-strings.html | 6 |
5 files changed, 23 insertions, 8 deletions
diff --git a/assets/css/default.css b/assets/css/default.css index c71291c..16887d3 100644 --- a/assets/css/default.css +++ b/assets/css/default.css @@ -763,7 +763,7 @@ micro-metadata-anchored { color: #111; color: var(--foreground); display: flex; - margin-bottom: 0.5rem; + margin-bottom: 0.25rem; margin-top: -0.5rem; width: 100%; } diff --git a/themes/default/layouts/_default/rss.xml b/themes/default/layouts/_default/rss.xml index a09f9bf..17334bf 100644 --- a/themes/default/layouts/_default/rss.xml +++ b/themes/default/layouts/_default/rss.xml @@ -32,7 +32,7 @@ <link>{{ .Permalink }}</link> <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <guid>{{ .Permalink }}</guid> - <description>{{ .Content | html }}</description> + <description>{{ partial "function-content.html" .Content | html }}</description> </item> {{ end }} {{ end }} diff --git a/themes/default/layouts/_default/summary.html b/themes/default/layouts/_default/summary.html index 44619f3..dcbb501 100644 --- a/themes/default/layouts/_default/summary.html +++ b/themes/default/layouts/_default/summary.html @@ -18,12 +18,7 @@ </details> <micro-unsafe-content> {{ end }} - {{- - .Content | - replaceRE "<p>\n<figure>" "<figure>" | - replaceRE "</figure></p>" "</figure>" | - safeHTML - -}} + {{- partial "function-content.html" .Content | safeHTML -}} {{ if .Params.unsafe }} </micro-unsafe-content> </micro-unsafe> diff --git a/themes/default/layouts/partials/function-content.html b/themes/default/layouts/partials/function-content.html new file mode 100644 index 0000000..be33ba0 --- /dev/null +++ b/themes/default/layouts/partials/function-content.html @@ -0,0 +1,14 @@ +{{- $content := . -}} + +{{- + $content = $content | + replaceRE "<p><figure>" "<figure>" | + replaceRE "<p>\n<figure>" "<figure>" | + replaceRE "</figure></p>" "</figure>" | +-}} + +{{- if eq (len $content) 0 -}} + {{- $content = partial "function-strings.html" "messageNoContent" -}} +{{- end -}} + +{{- return $content -}} diff --git a/themes/default/layouts/partials/function-strings.html b/themes/default/layouts/partials/function-strings.html new file mode 100644 index 0000000..37de01a --- /dev/null +++ b/themes/default/layouts/partials/function-strings.html @@ -0,0 +1,6 @@ +{{- $string := . -}} + +{{- if eq $string "messageExpired" -}} {{- $string = "This message has expired." -}} {{- end -}} +{{- if eq $string "messageNoContent" -}} {{- $string = "This message contains no content." -}} {{- end -}} + +{{- return $string -}} |