From e10f74c5b696c836eb39f569932190896dec926a Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Fri, 12 Jun 2026 10:16:09 +0100 Subject: [PATCH] http: adds blog index page --- http/src/blog.upphtml | 78 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 http/src/blog.upphtml diff --git a/http/src/blog.upphtml b/http/src/blog.upphtml new file mode 100644 index 0000000..4b7abf7 --- /dev/null +++ b/http/src/blog.upphtml @@ -0,0 +1,78 @@ +#! +PAGE="$1" +SITE_URL="$2" +export TITLE="Joe Carstairs" +export DESCRIPTION="Joe Carstairs' personal website" + +POSTS="$(ls "${SRC}/blog/" | grep "^[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\.blog.upphtml$")" +set -- +for post in $POSTS +do + this_year="$( echo "$post" | cut -c1-4 )" + has_this_year=0 + for year in $@ + do + if [ "$this_year" = "$year" ] + then + has_this_year=1 + break + fi + done + if [ $has_this_year -eq 0 ] + then + set -- $@ "$this_year" + fi +done +YEARS="$@" + +pp "${SHARE}"/components/meta.upphtml +#! + +
+ +
+ +

My blog

+ + + +
+

How to subscribe to this blog

+
+ +#! +for year in $YEARS; do +#! +

${year}

+ +
    + +#! +for post in $POSTS; do if [ "$(echo "${post}" | cut -c1-4)" = "$year" ]; then +title="$(grep "^export TITLE=" "${SRC}/blog/${post}" | cut -c15-)" +title="${title::${#title}-16}" +date_published="$(echo "${post}" | cut -c1-10)" +href="${SITE_URL}/blog/$(echo "$post" | cut -c1-10).html" +#! + +
  • +

    ${title}

    +#! +DATE="${date_published}" CLASS="dt-published" pp "${SHARE}/components/formatted_date.upphtml" +#! +
  • + +#! +fi; done +#! + +
+ +#! +done +#! + +