summaryrefslogtreecommitdiff
path: root/feed.xml.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'feed.xml.tmpl')
-rw-r--r--feed.xml.tmpl43
1 files changed, 36 insertions, 7 deletions
diff --git a/feed.xml.tmpl b/feed.xml.tmpl
index c95aa53..8952437 100644
--- a/feed.xml.tmpl
+++ b/feed.xml.tmpl
@@ -3,19 +3,48 @@
<subtitle>Notes, code, and longer thoughts from an elder-millennial software engineer in Salt Lake City.</subtitle>
<link href="https://tjp.lol/feed.xml" rel="self"/>
<link href="https://tjp.lol/"/>
- {{$posts := sortPages (index .Pages "weblog") "post_date"}}{{with slicePages $posts 0 1}}<updated>{{range .}}{{rfc3339 (index .Meta "post_date")}}{{end}}</updated>{{else}}<updated>2026-07-11T00:00:00Z</updated>{{end}}
+ {{$posts := sortPages (index .Pages "weblog") "post_date" "mod_time" -}}
+ {{with slicePages $posts 0 1 -}}
+ <updated>
+ {{- range . -}}
+ {{$post_date := or (index .Meta "post_date") .ModTime -}}
+ {{rfc3339 $post_date}}
+ {{- end -}}
+ </updated>
+ {{- else -}}
+ <updated>2026-07-11T00:00:00Z</updated>
+ {{- end}}
<id>https://tjp.lol/</id>
<author>
<name>tjp</name>
<email>t@tjp.lol</email>
</author>
- {{range $posts}}<entry>
+ {{range $posts -}}
+ {{$post_date := or (index .Meta "post_date") .ModTime -}}
+ <entry>
<title>{{.Title}}</title>
<link href="{{.CanonicalURL}}"/>
<id>{{.CanonicalURL}}</id>
- <published>{{rfc3339 (index .Meta "post_date")}}</published>
- <updated>{{if index .Meta "updated"}}{{rfc3339 (index .Meta "updated")}}{{else}}{{rfc3339 (index .Meta "post_date")}}{{end}}</updated>
- {{with .Sections}}<content type="html">{{xml (index . 0)}}</content>
- {{end}}
- </entry>{{end}}
+ <published>{{rfc3339 $post_date}}</published>
+ <updated>
+ {{- if index .Meta "updated" -}}
+ {{rfc3339 (index .Meta "updated")}}
+ {{- else -}}
+ {{rfc3339 $post_date}}
+ {{- end -}}
+ </updated>
+ <content type="html">
+ {{- $sawH1 := false}}
+ {{- $lede := true}}
+ {{- range .Sections}}
+ {{- if and $sawH1 $lede}}
+ {{- xml .}}
+ {{- $lede = false}}
+ {{- else if eq (printf "%.3s" .) "<h1"}}
+ {{- $sawH1 = true}}
+ {{- end}}
+ {{- end -}}
+ </content>
+ </entry>
+ {{- end}}
</feed>