From a5d07f20655010e0d55ae169a6d8acdac922fc52 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Fri, 30 May 2025 00:33:24 -0700 Subject: [PATCH] Enable news header/footer, as well as let people change the output filename of the news index. --- build.sh | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index c9055c8..4173d41 100755 --- a/build.sh +++ b/build.sh @@ -199,7 +199,13 @@ site_button() then BTN_SEARCHPATH="./sites/$1/news" BTN_NAME="news" - BTN_PAGE="index" + + if [ -f "./sites/$1/news/outputfile" ] + then + BTN_PAGE=$(head -n 1 "./sites/$1/news/outputfile") + else + BTN_PAGE="index" + fi else BTN_SEARCHPATH="./sites/$1/$2/$3" BTN_NAME="$3" @@ -249,7 +255,15 @@ site_process() TMP_PAGES_R="./sites/$1/tmp_pagesr" TMP_PAGES_L="./sites/$1/tmp_pagesl" - OUT_INDEX="./out/$1/index.html" + + if [ -f "./sites/$1/news/outputfile" ] + then + OUTFILE=$(head -n 1 "./sites/$1/news/outputfile") + else + OUTFILE=index + fi + + OUT_INDEX="./out/$1/$OUTFILE.html" SITE_TITLE=$(cat "./sites/$1/domain") # delete output dir if it exists# @@ -266,8 +280,8 @@ site_process() saferm "$TMP_PAGES_L" # before we collect all pages, add a 'News' button: - site_button "$1" "news" "index" "News" >> "$TMP_PAGES_L" - #echo "• News
" >> "$TMP_PAGES_L" + site_button "$1" "news" "$OUTFILE" "News" >> "$TMP_PAGES_L" + #echo "• News
" >> "$TMP_PAGES_L" # enumerate and list the right-aligned pages if [ -d "./sites/$1/pages_right" ] @@ -421,7 +435,19 @@ site_process() # generate the index full of news-pages html_start "$OUT_INDEX" "$SITE_TITLE" "$1" + + if [ -f "./sites/$1/news/header.html" ] + then + cat "./sites/$1/news/header.html" >> "$OUT_INDEX" + fi + cat "$TMP_NEWS" >> "$OUT_INDEX" + + if [ -f "./sites/$1/news/footer.html" ] + then + cat "./sites/$1/news/footer.html" >> "$OUT_INDEX" + fi + html_end "$OUT_INDEX" "$1" # copy over data @@ -441,4 +467,4 @@ find ./sites -name domain | while read SITE do DOMAIN=$(basename $(dirname "$SITE")) site_process "$DOMAIN" -done \ No newline at end of file +done