diff --git a/blog-refresh.sh b/blog-refresh.sh
index b22d525..6d48456 100755
--- a/blog-refresh.sh
+++ b/blog-refresh.sh
@@ -4,6 +4,16 @@ output() {
echo "$1" >> index.html
}
+add_header() {
+ output '
Blog index
'
+ output ''
+}
+
+add_footer() {
+ html_entry "legacy" "before 2020" "Older posts"
+ output '
'
+}
+
html_entry() {
output ''
path="$1"
@@ -38,12 +48,9 @@ cd /home/nginx/html/blog
if has_updates; then
git pull &> /dev/null
rm -f index.html
- output 'Blog index
'
- output ''
+ add_header
ls -ltu src/*.md | tail -n+1 | while read f; do create_entry $f; done
- html_entry "legacy" "before 2020" "Older posts"
- output '
'
- output ""
+ add_footer
# Human-readable output for the cron notification
echo 'Updated blog to:'
git log -1