From 6b49431f10551571ec6809eeca3e74fa84552d74 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Mon, 4 Nov 2024 02:05:23 +0100 Subject: [PATCH] Update nav to be dynamic based on page I feel like I had this code a LONG time ago --- bin/genpage | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/bin/genpage b/bin/genpage index f3bda64..bed076d 100755 --- a/bin/genpage +++ b/bin/genpage @@ -25,24 +25,36 @@ cat < EOM +dir=$(dirname "/$1") +if [ $(basename "$1") = "index.txt" ]; then + dir=$(dirname $dir) +fi + +while [ "$dir" != "/" ]; do + part=$(basename $dir) + path=${dir##/www} + if [ -z "$path" ]; then + path="/" + fi + echo " / $part" | sed 's/www/home/' + dir=$(dirname $dir) +done | sed -n '1!G;h;$p' # reverse lines + +echo '' + nihdoc < "$1" -if echo "$1" | grep -q -v "index.txt"; then - cat <
-Last Updated: $(git -C "$GITDIR" log --pretty="%cs" -n 1 -- "$1") +Last Updated: $(git -C "$GITDIR" log --pretty="%cs" -n 1 -- "$1") +(License) EOM -fi cat < -- libgit2 1.8.1