fusch.online

git / lists / casts

git.fusch.online/planner

Generate static pages from a list of links
git clone git://git.fusch.online/planner
Log / Files / Readme / Issues

commit 0ca44e47ad3a5050dc4a0e688a147689574ab2fc
parent 0e92f1aacef7f866900076f75dd624b1b8ac527b
Author: hbkk <tschugg@posteo.de>
Date:   Sun, 31 Mar 2019 15:40:15 +0200

add rss feed generator

Diffstat:
Mlinks.sh | 30++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/links.sh b/links.sh @@ -2,6 +2,7 @@ tmp=$(mktemp) offline=false +pubdate=$(date +"%a, %d %b %Y %H:%M:%S %z") # main @@ -11,15 +12,15 @@ offline=false } mkdir -p ./site - touch ./db.csv +touch ./links.txt cat <<EOF > ./site/index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> - <title>links</title> + <title>planner#home</title> <style> body { width: 60em; @@ -84,7 +85,17 @@ cat <<EOF > ./site/index.html </style> </head> <body> - <h1>links</h1> + <h1>planner</h1> +EOF + +cat << EOF > ./site/rss +<?xml version="1.0" encoding="UTF-8" ?> +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"> +<channel><title>links</title><link>file:///home/hbkk/tmp/site/index.html</link> +<description>planner auf der wippe</description><language>en</language> +<lastBuildDate>$pubdate</lastBuildDate> +<pubDate>$pubdate</pubDate> +<atom:link href=\"file:///home/hbkk/tmp/site/rss\" rel=\"self\" type=\"application/rss+xml\" /> EOF while read -r line; do @@ -142,11 +153,16 @@ EOF "./$tag.html" "$tag" >> ./site/index.html done - printf " <a class=\"tag\" href=\"%s\">%s</a>\n" \ - "./$date.html" "$date" >> ./site/index.html - printf " </div>\n" >> ./site/index.html + cat << EOF >> ./site/rss +<item><title>$title</title><description><![CDATA[$link]]></description> +<link>$link</link> +<guid>$link</guid> +<dc:creator>tutti</dc:creator> +<pubDate>$pubdate</pubDate></item> +EOF + done < "${1:-./links.txt}" cat << EOF >> ./site/index.html @@ -154,4 +170,6 @@ cat << EOF >> ./site/index.html </html> EOF +echo '</channel></rss>' >> ./site/rss + mv "$tmp" ./db.csv