From 1cc2a659c29509543436e9c1e65462b64bc09296 Mon Sep 17 00:00:00 2001 From: JP Hastings-Spital Date: Fri, 31 Jan 2025 16:18:22 +0000 Subject: [PATCH] Simplify RSS layout --- layouts/_default/rss.xml | 38 ++------------------------------ layouts/partials/description.txt | 9 ++++++++ layouts/partials/feedpost.html | 24 ++++++++++++++++++++ 3 files changed, 35 insertions(+), 36 deletions(-) create mode 100644 layouts/partials/description.txt create mode 100644 layouts/partials/feedpost.html diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 3c3194af..0779d099 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -33,42 +33,8 @@ {{ if .Page.Params.Audio }}{{end}} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} {{ .Permalink | absURL }} - - {{- if .Params.bookmarkOf -}} - {{- $reference := partial "reference.obj" (dict "url" .Params.bookmarkOf "page" .) -}} - Thoughts on a bookmarked article{{ with $reference.name }}: {{.}}{{ end }}. - {{- else -}} - {{- if eq .Section "calendar" -}}(An event I may be going to.) {{ end -}} - {{- $desc := (index (split .Summary "\n") 0) | plainify | safeHTML -}} - {{- $desc -}} - {{- range .Params.tags }} #{{.}}{{ end -}} - {{- end -}} - - - {{- range $i, $src := .Params.Media }} - <img src="{{ path.Join $page.RelPermalink $src.url | absURL }}" {{ with $src.alt }}alt="{{ . }}" {{ end }}/><br/> - {{- end }} - {{- if eq .Section "calendar" -}} - {{ $timing := dict -}} - {{ range .Params.timings -}} - {{ if (time.AsTime .starts).After time.Now -}} - {{ $timing = . -}} - {{ break -}} - {{ end -}} - {{ end -}} - {{ if $timing }} - <p><i><small>I'm planning on going to this event on - {{ partial "year-relative-date.txt" (time.AsTime $timing.starts) }}. - See the bottom of <a href="{{ .Permalink | absURL }}#post-info">the post</a> for more information, and get in touch if you'd like to go together!</small></i></p> - {{ end }} - {{- end -}} - {{ if .Params.bookmarkOf }} - <p><i><small>{{ partial "bookmark-of.html" . | html }}</small></i></p> - {{ else if .Params.inReplyTo }} - <p><i><small>{{ partial "in-reply-to.html" . | html }}</small></i></p> - {{ end }} - {{ .Content | html }} - + {{- partial "description.txt" . -}} + {{- partial "feedpost.html" . | html -}} {{- range .Params.syndications}} {{ . }} {{- end }} diff --git a/layouts/partials/description.txt b/layouts/partials/description.txt new file mode 100644 index 00000000..8effcbe2 --- /dev/null +++ b/layouts/partials/description.txt @@ -0,0 +1,9 @@ +{{- if .Params.bookmarkOf -}} + {{- $reference := partial "reference.obj" (dict "url" .Params.bookmarkOf "page" .) -}} + Thoughts on a bookmarked article{{ with $reference.name }}: {{.}}{{ end }}. +{{- else -}} + {{- if eq .Section "calendar" -}}(An event I may be going to.) {{ end -}} + {{- $desc := (index (split .Summary "\n") 0) | plainify | safeHTML -}} + {{- $desc -}} + {{- range .Params.tags }} #{{.}}{{ end -}} +{{- end -}} \ No newline at end of file diff --git a/layouts/partials/feedpost.html b/layouts/partials/feedpost.html new file mode 100644 index 00000000..a6cab6ed --- /dev/null +++ b/layouts/partials/feedpost.html @@ -0,0 +1,24 @@ +{{- $page := . -}} +{{- range $i, $src := .Params.Media -}} +
+{{- end }} +{{- if eq .Section "calendar" -}} + {{ $timing := dict -}} + {{ range .Params.timings -}} + {{ if (time.AsTime .starts).After time.Now -}} + {{ $timing = . -}} + {{ break -}} + {{ end -}} + {{ end -}} + {{ if $timing }} +

I'm planning on going to this event on + {{ partial "year-relative-date.txt" (time.AsTime $timing.starts) }}. + See the bottom of the post for more information, and get in touch if you'd like to go together!

+ {{ end }} +{{- end -}} +{{ if .Params.bookmarkOf }} +

{{ partial "bookmark-of.html" . | html }}

+{{- else if .Params.inReplyTo -}} +

{{ partial "in-reply-to.html" . | html }}

+{{ end }} +{{ .Content }} \ No newline at end of file