summaryrefslogtreecommitdiff
path: root/rss.sh
blob: c494ac3a1d04bb535c17f78a4e2953d9777ec563 (plain)
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
32
33
34
35
36
37
38
#!/bin/sh

blogfile="./blogs"
link="https://seacrossedlovers.xyz/blogger/blogs/output"
rss="./blogs/output/rss.xml"


echo """
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">

<channel>
  <title>Thing 1's blog</title>
  <link>${link}/index.html</link>
  <description>Definatly exists</description>
""" > $rss

blogs=$(ls $blogfile/*.blog)
for i in $blogs; do
        out=$(echo $i | rev | cut -d '/' -f 1 | cut -d '.' -f 2- | rev)
        contents=$(cat $i | head)

        echo """
  <item>
      <title>${out}</title>
      <link>${link}/${out}.html</link>
      <description>${contents}
      </description>
  </item>
        """ >> $rss
done



echo """
</channel>
</rss>
""" >> $rss