aboutsummaryrefslogtreecommitdiff
path: root/rss
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-07-16 16:56:43 +0200
committerlonkaars <loek@pipeframe.xyz>2021-07-16 16:56:43 +0200
commit861b955552d42b048d1ba17d4a48c953aeefe272 (patch)
tree629b91ff14e422a69682f267f085f170fd2ab251 /rss
parenta10ce5d3e2e95ebe88ecdfd22a0fc689def2ab9c (diff)
add rss feed
Diffstat (limited to 'rss')
-rw-r--r--rss/base.xml10
-rwxr-xr-xrss/genrss27
2 files changed, 37 insertions, 0 deletions
diff --git a/rss/base.xml b/rss/base.xml
new file mode 100644
index 0000000..daa65ad
--- /dev/null
+++ b/rss/base.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
+ <channel>
+ <title>Loek's excruciatingly interesting blog</title>
+ <description>This is where I post updates on things that I do</description>
+ <language>en-us</language>
+ <link>https://blog.pipeframe.xyz/atom.xml</link>
+ <atom:link href="https://blog.pipeframe.xyz/atom.xml" rel="self" type="application/rss+xml" />
+ </channel>
+</rss>
diff --git a/rss/genrss b/rss/genrss
new file mode 100755
index 0000000..7cfd005
--- /dev/null
+++ b/rss/genrss
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+cd $(dirname $0)
+
+# exit if no out dir
+[[ ! -d ../out ]] && exit 1
+
+cp base.xml atom.xml
+for file in ../out/post/*; do
+ base=$(basename "$file" .html)
+
+ xml ed -L \
+ -s '/rss/channel' -t elem -n item \
+ --var newitem '$prev' \
+ -s '$newitem' -t elem -n title -v "$(../scripts/meta title "../posts/${base}.md" | jq --raw-output)" \
+ -s '$newitem' -t elem -n guid -v "$base" \
+ -s '$newitem' -t elem -n link -v "/post/$base" \
+ -s '$newitem' -t elem -n pubDate -v "$(../scripts/meta date "../posts/${base}.md" | jq --raw-output)" \
+ -s '$newitem' -t elem -n description -v "$(pup -f "../out/post/${base}.html" .contentWrapper)" \
+ atom.xml
+done
+
+mv atom.xml ../public
+
+cd ..
+npx next build
+npx next export