blog

git clone https://git.ce9e.org/blog.git

commit
1e13e5fcd5bdfc0a7cb1a85bf27e9c4130faa463
parent
9701875c8b23d48775c2967b946748773bb859e4
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-03-26 00:50
split homepage by year

Diffstat

M posts.sh 10 ++++++++++

1 files changed, 10 insertions, 0 deletions


diff --git a/posts.sh b/posts.sh

@@ -4,7 +4,17 @@ getyml() {
    4     4 	grep "^$1:" "$2" | head -n 1 | sed "s/$1"': //;s/^"\(.*\)"$/\1/'
    5     5 }
    6     6 
   -1     7 prev_year=''
   -1     8 
    7     9 ls _content/posts | tac | while read -r l; do
   -1    10 	year=$(echo "$l" | cut -d- -f1)
   -1    11 	if [ "$year" != "$prev_year" ]; then
   -1    12 		echo
   -1    13 		echo "## $year"
   -1    14 		echo
   -1    15 		prev_year="$year"
   -1    16 	fi
   -1    17 
    8    18 	yml="_content/posts/$l/index.md"
    9    19 	echo "- [$(getyml 'title' "$yml")](/posts/$l/)"
   10    20 done