make atom feeds valid

This commit is contained in:
yosh 2024-04-19 15:46:54 -04:00
parent 23499711bc
commit 1e4a8c5720
3 changed files with 11 additions and 7 deletions

View File

@ -13,13 +13,15 @@ feed="$_BUILDDIR/articles/feed.atom"
while read -r time hash subject; do
date=$(date -u -d "@$time" +"%Y-%m-%dT%TZ")
desc="" files=""
uuid=$(uuidgen --sha1 -n @url -N "$hash")
# print header (only on first one)
if [ -z "$flag" ]; then
printf '%s\n' '<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<link rel="self" type="application/atom+xml" href="https://unix.dog/~yosh/articles/feed.atom" />
<link rel="alternate" type="text/html" href="https://unix.dog/~yosh/articles" />
<title>yosh'\''s articles</title>
<link href="https://unix.dog/~yosh/articles/"/>
<author><name>yosh</name></author>
<updated>'"$date"'</updated>
<id>urn:uuid:'"$articles_uuid"'</id>'
@ -37,7 +39,7 @@ while read -r time hash subject; do
s/\.md /\.html /
s/ / --> /
s/^/<li><p>/
s/$/<\/li><\/p>/
s/$/<\/p><\/li>/
p
}
')
@ -45,11 +47,11 @@ while read -r time hash subject; do
printf '<entry>
<title>%s</title>
<link rel="alternate" href="/~yosh/articles"/>
<id>%s</id>
<link rel="alternate" href="/~yosh/articles" />
<id>urn:uuid:%s</id>
<updated>%s</updated>
<content type="html">%s</content>
</entry>\n' "$(escape "$subject")" "$hash" "$date" "$(escapepipe <<-EOF
</entry>\n' "$(escape "$subject")" "$uuid" "$date" "$(escapepipe <<-EOF
<ul>
${desc:+"<p>$desc</p>$_NL"}$files
</ul>

View File

@ -37,7 +37,7 @@ while IFS= read -r _entry; do
entries="$entries"'
<entry>
<title>'"$title"'</title>
<link rel="alternate" href="'"/~yosh/blog/${_entry%.md}.html"'"/>
<link rel="alternate" href="'"/~yosh/blog/${_entry%.md}.html"'" />
<id>urn:uuid:'"$uuid"'</id>
<published>'"$ctime"'</published>
<updated>'"$mtime"'</updated>
@ -50,8 +50,9 @@ EOF
header='<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<link rel="self" type="application/atom+xml" href="https://unix.dog/~yosh/blog/feed.atom" />
<link rel="alternate" type="text/html" href="https://unix.dog/~yosh/blog" />
<title>yosh'\''s blog</title>
<link href="https://unix.dog/~yosh/blog/"/>
<author><name>yosh</name></author>
<updated>'"$(echo "$all_mtimes" | sort -r | head -n 1)"'</updated>
<id>urn:uuid:'"$blog_uuid"'</id>'

View File

@ -1,6 +1,7 @@
---
title = I love this mix so fucking much
ctime = 2024-04-03T06:32:23Z
uuid = a49e70b4-5b92-404e-96a2-c66aaeb857f7
TB_TITLE = INFINITE MP
---