From 57f783cdfbdfbfd3dfa30da9adb7bba88da0ecd5 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 29 Dec 2022 23:18:51 +0100 Subject: Added year to blog index --- build.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'build.sh') diff --git a/build.sh b/build.sh index 7cb3ff1..6e8e74e 100755 --- a/build.sh +++ b/build.sh @@ -61,6 +61,13 @@ makeblog() { f="src/blog/$i/*.md" d=$(echo $i | grep -oE '^[0-9]{4}-[0-9]{2}-[0-9]{2}') t=$(head -n 1 $f | sed 's/# //') + + thisyear=$(echo $d | sed 's/-.*//') + if [ "$thisyear" != "$lastyear" ]; then + printf "\n## $thisyear\n\n" >> $bf + lastyear=$thisyear + fi + echo "* $d [$t]($i)" >> $bf echo "" >> $ff @@ -86,6 +93,12 @@ gemblog() { if [ -d src/blog/$i ]; then d=$(echo $i | grep -oE '^[0-9]{4}-[0-9]{2}-[0-9]{2}') t=$(head -n 1 src/blog/$i/*.md | sed 's/# //') + + thisyear=$(echo $d | sed 's/-.*//') + if [ "$thisyear" != "$lastyear" ]; then + printf "\n## $thisyear\n\n" >> $bg + lastyear=$thisyear + fi echo "=> $i $d $t" >> $bg fi done -- cgit v1.3