From 02a9eefdf24976f973caa83de797e374ffd669a8 Mon Sep 17 00:00:00 2001 From: eyedeekay Date: Tue, 16 Jul 2024 14:42:58 -0400 Subject: [PATCH] Make the blog post match up when author presupplies a DATE to the create_new_entry.sh script --- create_new_entry.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/create_new_entry.sh b/create_new_entry.sh index c9d975d..cf795e9 100755 --- a/create_new_entry.sh +++ b/create_new_entry.sh @@ -13,6 +13,14 @@ ENTRIES=data/$I2P_OS/$I2P_BRANCH/entries.html UUIDGEN="`which uuidgen || which uuid`" if [ -z "$DATE" ]; then DATE=$(date +%Y-%m-%dT%H:00:00Z) + YEAR=$(date +%Y) + MONTH=$(date +%m) + DAY=$(date +%d) +else + DATE2=$(echo "$DATE" | sed 's/T.*//') + YEAR=$(echo "$DATE2" | cut -d - -f 1) + MONTH=$(echo "$DATE2" | cut -d - -f 2) + DAY=$(echo "$DATE2" | cut -d - -f 3) fi if [ -z "$HREF" ]; then if [ ! -z "$CHANGEME_URL_HERE" ]; then @@ -20,7 +28,7 @@ if [ -z "$HREF" ]; then else CHANGEME_URL_HERE=$(echo "$TITLE" | tr "[:upper:]" "[:lower:]" | sed 's| |_|g') fi - HREF="http://i2p-projekt.i2p/en/blog/post/"$(date +%Y)/$(date +%m)/$(date +%d)"/$CHANGEME_URL_HERE" + HREF="http://i2p-projekt.i2p/en/blog/post/$YEAR/$MONTH/$DAY/$CHANGEME_URL_HERE" fi TITLE=${TITLE:-TITLE_HERE} AUTHOR=${AUTHOR:-AUTHOR_HERE}