Site progress

Its 2022 now, crazy how quickly last year flew by.

I’ve recently made a couple changes to the site so I thought I’d make a post listing them:

So far I’m really enjoying working on this site. It’s making me appreciate how much I can do without libraries. This sites content is still built using a shell script however I might try write either a C or Rust program to manage drafts and all that jazz.

RSS was a fun challenge btw. It’s really hard to find any guides online so I basically had to follow the RFC. Here’s the script I use to generate my feed:

# Create RSS feed
RSS_ITEMS=()
echo "Creating RSS feed..."
cd "$BLOG_LOCATION"
for file in $BLOG_LOCATION/*.md; do
  NAME="$(basename "$file")"
  TITLE="$(grep "^title:" "$file" | sed 's/[^ ]* //')"
  DESCRIPTION="$(grep "^summary:" "$file" | sed 's/[^ ]* //')"
  EDIT_TIME="$(git log -1 --pretty="format:%ci" "$file" | cut -d" "  -f2)"
  PUB_DATE="$(date -d"${NAME%$FILE_PREFIX.md}" +"%a, %d %b %Y ${EDIT_TIME:-$RSS_TIME} $TIMEZONE")"
  DRAFT="$(grep "^draft:" "$file" | sed 's/[^ ]* //')"
  GUID="$(echo "$FILENAME $PUB_DATE" | md5sum | cut -f1 -d" ")"

  if [ ! "$DRAFT" ]; then
    RSS_ITEMS+=("
      <item>
        <guid isPermaLink='false'>${GUID}</guid>
        <title>${TITLE}</title>
        <link>https://${DOMAIN_NAME}/blog/${NAME%$FILE_PREFIX.md}.html</link>
        <description>${DESCRIPTION:-$TITLE}</description>
        <pubDate>${PUB_DATE}</pubDate>
      </item>
    ")
  fi
done
cd "$PARENT_PATH"
RSS_STRING=$(printf '%s' "${RSS_ITEMS[@]}" | tr -d '\n')
sed -i -e "s|RSS_PLACEHOLDER|$RSS_STRING|g" ./out/rss.xml

I’m finding shell more and more powerful as I use it more. I know I’ve still got heaps to learn though.


contact at pfy dot ch