#!/bin/bash ############# # DESCRIPTION ############# # Recursively crawls through the site and reads page metadata to generate an RSS feed for all content on the website. # # The script will output the completed RSS feed to the location specified as an argument. # ############# # Usage: # build_rss rss.xml build_rss() ( # Switch to rss file's directory touch $1 rss=$(realpath $1) cd $(dirname $1) # Wipe out the existing rss feed, if there is one, and declare our new rss feed # Note that metadata descriptors are pulled from the index.md file that lives in the same folder as the destination for the rss.xml file. get_page_metadata index.md cat > $rss < $global_name $description $base_url $language Arise EOF [[ $favicon != '' ]] && { cat >> $rss < $base_url$favicon $global_name $base_url EOF } cat >> $rss < 60 $(date --rfc-822) EOF # List every directory in our sitemap (except config). This makes up our sitemap since Arise is built to use directory roots as page URLs find . -type d -not \( -path ./config -prune \) | while read fname; do page_index=$(realpath "$fname"'/index.md') if [ -e $page_index ]; then get_page_metadata $page_index if [[ $rss_hide != "true" ]] && [[ $is_toc != "true" ]]; then # Convert html's ISO8601 date to RSS's RFC-822. Fuck you RSS. rss_date=$(date -d "$published_date" --rfc-822) cat >> $rss < $title $author $description $canonical_url $rss_date EOF fi clear_metadata fi done # Close up the rss feed echo -e '\n' >> $rss )