Allow setting and overriding publish_dir

This commit is contained in:
Siina Mashek 2024-02-17 17:11:38 +02:00
parent ab4dc14c19
commit e7e520fcf3
2 changed files with 11 additions and 3 deletions

View File

@ -6,6 +6,7 @@ lastupdated="true"
site_title="koutsie's telenotes"
site_description="thoughts about mainly computers... maybe recipes and cats too?"
site_link="https://k0.tel/"
publish_dir="."
# Put CSS between <<EOF and EOF
site_css=$(cat <<EOF

View File

@ -1,8 +1,6 @@
#!/bin/bash
# noter 1.3.0 - "nice configs" - @k@layer8.space - mit
source ./config.sh
# a pretty nifty little logging utility!
nlog() {
local ORANGE='\033[0;33m'
@ -12,6 +10,11 @@ nlog() {
echo -e "${ORANGE}[noter] ${calling_function} | ${1} ${NO_COLOR}"
}
nlog "sourcing config.sh"
source ./config.sh
# Override publish dir if passed as cli arg
[[ ! -z "$1" ]] && nlog "overriding publish_dir to $1" && publish_dir="$1"
if [ ! -d "notes" ]; then
nlog "Error: 'notes' folder not found!"
@ -133,8 +136,12 @@ generate_rss_feed() {
# godspeed notecount...
notecount=$(find notes -name "*.txt" ! -empty | wc -l)
if [ ! -d "${publish_dir}" ]; then
nlog "Creating ${publish_dir}"
mkdir -p "${publish_dir}"
fi
# Create HTML file
output_file="index.html"
output_file="${publish_dir}/index.html"
echo "<!DOCTYPE html>
<html>
<head>