💡 Pro zs Tip: Need a way to include “dynamic” content or other files? Here’s a simple “include” plugin you can use:
$ cat .zs/include.sh
#!/bin/sh
if [ ! $# = 1 ]; then
printf "Usage: %s <file>\n" "$(basename "$0")"
exit 0
fi
fn="${ZS_OUTDIR}/$1"
if [ -f "${ZS_OUTDIR}/$1" ]; then
cat "${ZS_OUTDIR}/$1"
else
echo "error: file not found ${ZS_OUTDIR}/$1"
fi
Usage: {{ include.sh twtxt.txt }}
(as used by the Yarn.social site and to include a full-example feed in the “Manually” section (Thanks to @autiomaa for this feedback! 🙇♂️) #Yarn.social #zs #static-site #static-site-generator
Apparently I can’t write shell scripts very well late at night 🤦♂️ Here’s the fixed include
plugin for zs:
#!/bin/sh
if [ ! $# = 1 ]; then
printf "Usage: %s <file>\n" "$(basename "$0")"
exit 0
fi
if [ -f "$1" ]; then
cat "$1"
else
echo "error: file not found $1"
fi
Sorry 😅