Enable news header/footer, as well as let people change the output filename of the news index.

This commit is contained in:
Marco Cawthorne 2025-05-30 00:33:24 -07:00
parent e8cc5e66ec
commit a5d07f2065
1 changed files with 31 additions and 5 deletions

View File

@ -199,7 +199,13 @@ site_button()
then
BTN_SEARCHPATH="./sites/$1/news"
BTN_NAME="news"
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 "<a href=\"index.html\">&#8226; News</a><br>" >> "$TMP_PAGES_L"
site_button "$1" "news" "$OUTFILE" "News" >> "$TMP_PAGES_L"
#echo "<a href=\"$OUTFILE.html\">&#8226; News</a><br>" >> "$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