aboutsummaryrefslogtreecommitdiff
path: root/rss.esh
blob: 39e8d99c23efe5f07cc132f4eb66942a07ed74c9 (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
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
      <title>nerdypepper's μblog</title>
      <link>https://peppe.rs</link>
      <description>programming, design, software</description>
      <atom:link href="https://peppe.rs/index.xml" rel="self" type="application/rss+xml" />
      <image>
        <title>nerdypepper's μblog</title>
        <url>https://u.peppe.rs/n.png</url>
        <link>https://peppe.rs</link>
      </image>
      <language>en-us</language>
      <copyright>Creative Commons BY-NC-SA 4.0</copyright>
      <% for f in `ls -t ./posts`; do
          file="./posts/"$f
          post_date=$(date -u -r "$file" "+%a, %d %b %Y %H:%M:00 %z")
          html=$(pandoc -t html "$file" | sed -e "s/&/\&amp;/g" -e "s/</\&lt;/g" -e "s/>/\&gt;/g")
          id="${file##*/}"
          id="${id%.*}"
          post_title=$(echo "$id" | sed -E -e "s/\..+$//g"  -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g")
          post_link="https://peppe.rs/posts/$id/"

          echo "<item>"

          echo "<title>$post_title</title>"
          echo "<description>$html</description>"
          echo "<link>$post_link</link>"
          echo "<pubDate>$post_date</pubDate>"
          echo "<guid>$post_link</guid>"

          echo "</item>"

          done
      %>

    </channel>
</rss>