diff options
Diffstat (limited to 'rs.sh')
-rwxr-xr-x | rs.sh | 36 |
1 files changed, 0 insertions, 36 deletions
@@ -1,36 +0,0 @@ -#!/bin/sh -# Seen, a simple static blog generator -# Copyright (C) 2021 Vitali64 <vitali64pmemail@protonmail.com> -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# Please see the LICENSE file for more details. -die() { - echo "-> [$(date +%R)] (!) ERROR: Unexpected error, please report : $1 (!)" - exit 1 -} -articles="$(find articles/*.md|sed -e 's@.md@@g' -e 's@articles/@@g')" || die "Unknown error" # Articles -echo "-> [$(date +%R)] Generating RSS feed ..." -# Set the defaults -rssBlogTitle="blog" -rssBlogDescription="It's a blog" -. "./rss.cfg" # Override the defaults -# Header of the RSS XML file -printf '%s\n' '<rss version="2.0">' > "www/rss.xml" -printf '%s\n' '<channel>' >> "www/rss.xml" -printf '%s\n' "<title>${rssBlogTitle}</title>" >> "www/rss.xml" -printf '%s\n' "<link>BLANK</link>" >> "www/rss.xml" -printf '%s\n' "<description>$rssBlogDescription</description>" >> "www/rss.xml" -for line in ${articles} # Items -do - echo "-> [$(date +%R)] Inserting XML ${line} item ..." - . "articles/${line}.cfg" - printf '%s\n' '<item>' >> "www/rss.xml" - printf '%s\n' "<title>${name}</title>" >> "www/rss.xml" - printf '%s\n' "<description>$(cat articles/${line}.md)</description>" >> "www/rss.xml" - printf '%s\n' '</item>' >> "www/rss.xml" -done -# Footer of the RSS XML file -printf '%s\n' '</channel>' >> "www/rss.xml" -printf '%s\n' '</rss>' >> "www/rss.xml" |