-
Notifications
You must be signed in to change notification settings - Fork 0
/
atom.xml.sh
executable file
·31 lines (31 loc) · 1 KB
/
atom.xml.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
cat <<XML
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" >
<link href="https://writing.kemitchell.com/atom.xml" rel="self" type="application/atom+xml" />
<link href="https://writing.kemitchell.com/" rel="alternate" type="text/html" />
<updated>$(date --iso-8601=minutes --universal | sed 's/+00:00/Z/')</updated>
<id>https://writing.kemitchell.com/atom.xml</id>
<title type="html">Artless Devices Blog</title>
XML
for meta in `find posts -iname "*.meta" | sort | tac`; do (
source "$meta"
timestamp=$(basename "$meta" ".meta")
permalink="https://blog.artlessdevices.com/$timestamp"
cat <<HTML
<entry>
<title>$title</title>
<link href="$permalink" rel="alternate" type="text/html" title="$title"/>
<id>$permalink</id>
<published>$timestamp</published>
<author>
<name>$author</name>
<email>$email</email>
</author>
<content type="html">$(commonmark < posts/$timestamp.content)</content>
</entry>
HTML
) done
cat <<XML
</feed>
XML