Archived
1
0
Fork 0

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_title="koutsie's telenotes"
site_description="thoughts about mainly computers... maybe recipes and cats too?" site_description="thoughts about mainly computers... maybe recipes and cats too?"
site_link="https://k0.tel/" site_link="https://k0.tel/"
publish_dir="."
# Put CSS between <<EOF and EOF # Put CSS between <<EOF and EOF
site_css=$(cat <<EOF site_css=$(cat <<EOF

View file

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