#!/bin/bash DIRECTORY="pages/blog" FILES=`ls $DIRECTORY/*.md -1 | sort` echo -n > blogdates.txt for f in $FILES; do MTIME=`git log -n 1 --pretty=format:%at $f` MTIME=${MTIME-9999999999} printf "%d\t%s\n" $MTIME $f >> blogdates.txt done # resort by last git commit time FILES=`cat blogdates.txt | sort -nr | cut -f 2-` cat << RSSHEADER rnd's blog https://rnd.neocities.org/blog The RSS feed of articles published on the blog thingy RSSHEADER for f in $FILES; do MTIME=`git log -n 1 --pretty=format:%at $f` TITLE=`head -n 1 $f` TITLE=${TITLE#"% "} OUTPAGE=${f%.md}.html OUTPAGE=/${OUTPAGE#pages/} echo "" echo "$TITLE" echo "$OUTPAGE" if [ $MTIME ]; then echo "`date -R -u -d \"@$MTIME\"`" fi echo "" done cat << RSSFOOTER RSSFOOTER