From 2d2d766e9af6a6de66140fb056be7c744dfabca0 Mon Sep 17 00:00:00 2001 From: Bill Date: Fri, 18 Nov 2022 21:58:23 -0500 Subject: Generate blog index from md --- mds/blog/blog-index.md | 13 +++++++++++++ publish-blog.sh | 21 +++++++++++++++++++++ tidy.conf | 1 + www/blog/index.html | 30 ++++++++++++++++-------------- 4 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 mds/blog/blog-index.md diff --git a/mds/blog/blog-index.md b/mds/blog/blog-index.md new file mode 100644 index 0000000..9691e42 --- /dev/null +++ b/mds/blog/blog-index.md @@ -0,0 +1,13 @@ +
+# Blog Index + + +1. [2022-11-06 - My Markdown -> HTML Setup](/blog/2022-11-06/) +1. [2021-01-05 - Manjaro Followup - Breaking things!](/blog/2021-01-05/) +1. [2020-12-17 - Manjaro Experiment](/blog/2020-12-17/) +1. [2020-02-17 - Bread Blog (First post)](/blog/bread/#2020-02-17/) +1. [2020-01-13 - remember/recall - what could've been a command line tool](/blog/2020-01-13/) +1. [2019-12-09 - Lisps, Assembly, C, and Conlangs](/blog/2019-12-09/) +1. [2019-02-17 - Venturing back into C](/blog/2019-02-17/) +1. [2019-01-21 - First! A New Years Resolution](/blog/2019-01-21/) +
diff --git a/publish-blog.sh b/publish-blog.sh index e36ee63..c5a483f 100755 --- a/publish-blog.sh +++ b/publish-blog.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash set -ex if [ $# -gt 2 ]; then @@ -42,3 +43,23 @@ mkdir -p ${path} sed -E -i "s/BLOG_DATE/${date}/" $out +# Update index (if needed) + +index=mds/blog/blog-index.md + +## check if exists +exists=0 +grep -q -c "$isodate - $title" $index || exists=$? + +# Doesn't exist +if [ $exists -eq 1 ]; then + marker="" + line="1. [${isodate} - ${title}](/blog/${isodate}/)" + sed -E -i "/$marker/a $line" $index + ./compile-md.sh page "Blog Index" $index www/blog/index.html +else + echo "Already exists in index - not updating" +fi + +echo "Done" + diff --git a/tidy.conf b/tidy.conf index f43552a..d6260a4 100644 --- a/tidy.conf +++ b/tidy.conf @@ -10,3 +10,4 @@ uppercase-tags: no uppercase-attributes: no new-pre-tags: code, show-warnings: no +hide-comments: yes diff --git a/www/blog/index.html b/www/blog/index.html index f1a98c2..4bd5c1a 100644 --- a/www/blog/index.html +++ b/www/blog/index.html @@ -4,7 +4,7 @@ - senders.io - Homepage + senders.io - Blog Index @@ -16,43 +16,45 @@ senders.io -
+