Add single-pager for all writing

main
Jonathan Dahan 12 months ago
parent ef72b1db06
commit 0cf6f85d0c

@ -21,8 +21,8 @@ find "$p" -type f -name "*.$t" | sort -r | while read -r file; do
name="${file#"$p"}"
name="${name#"/"}"
name="${name%.*}"
# skip the index
if [ "$name" = "index" ]; then continue; fi
# skip indices
if [[ "$name" == *index ]]; then continue; fi
title="$(zs vars "$file" title)"
if [ -z "$title" ]; then

@ -0,0 +1,41 @@
#!/bin/sh
#set -e
if [ ! $# = 1 ]; then
printf >&2 "Usage: %s <path> [ext]\n" "$(basename "$0")"
exit 0
fi
printf >&2 "hello world from %s" "$p"
p="$1"
t="${2:-md}"
if [ ! -d "$p" ]; then
printf >&2 "error: path %s not found\n" "$p"
exit 1
fi
find "$p" -type f -name "*.$t" | sort -r | while read -r file; do
name="${file#"$p"}"
name="${name#"/"}"
name="${name%.*}"
# skip the index
if [[ "$name" == *index ]]; then continue; fi
title="$(zs vars "$file" title)"
if [ -z "$title" ]; then
title="$name"
fi
postdate="$(zs vars "$file" postdate)"
if [ -z "$postdate" ]; then
inputdate=$(basename $file | cut -d- -f1-3)
postdate=$(date -j -f "%Y-%m-%d" "$inputdate" "+%h %Y")
fi
echo "#### $postdate"
ZS_LAYOUT=embed.html zs build $file
echo "---"
done

@ -0,0 +1 @@
{{ single-page writing }}

@ -1,6 +1,8 @@
<a href=#all-posts>all posts</a> (rss feed in the works...)
[post index](#post-index)
[all on one page](all)
[rss feed](#)
{{ latest writing }}
### all posts
### post index
{{ index writing }}

Loading…
Cancel
Save