From ce28889569c1e0914baca84a6ee893c734e079e7 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Tue, 3 Jun 2025 18:45:02 -0500 Subject: feat: build script now automatically updates index posts --- build.sh | 172 ++++++++++++++++++++++++++++++++------------- theme/templates/index.html | 42 +---------- 2 files changed, 125 insertions(+), 89 deletions(-) diff --git a/build.sh b/build.sh index 66887b3..506909c 100755 --- a/build.sh +++ b/build.sh @@ -1,56 +1,128 @@ -#!/bin/bash - -# Ensure the latest post is included on the home page -printf "Did you update the 'Recent Blog Posts' section? [yn] " -read answer - -# Only continue if latest post is included on the home page -if [[ "$answer" =~ ^[Yy]$ ]]; then - # Check if the environment flag is set to PROD - if [[ "$ENV" == "prod" ]]; then - echo "Environment: Production" - - # Check if publishing via LAN or remotely - printf "Publishing on remote or LAN? [r|l] " - - # Update ubuntu_server variable based on answer - read method - if [[ "$method" =~ ^[Rr]$ ]]; then - ubuntu_server="ubuntu-remote" - elif [[ "$method" =~ ^[Ll]$ ]]; then - ubuntu_server="ubuntu" - else - echo "Invalid input. Assuming LAN (ubuntu)" - ubuntu_server="ubuntu" - fi - - # Remove previous build - rm -rf .build/* - - # Minify CSS - minify -o theme/static/styles.min.css theme/static/styles.css - - # Run publishing script - emacs --script publish.el &>/dev/null - - # Deploy changes - rsync -r --delete-before .build/* $ubuntu_server:/var/www/cleberg.net/ - else - echo "Environment: Development" +#!/usr/bin/env bash +set -e + +# ----------------------------------------------------------------------------- +# Function: generate_recent_posts +# After publishing to .build/, finds the 3 newest HTML files under .build/blog +# (excluding blog index.html), extracts each post’s date/title/tags by: +# -