From bd76e6e9b6043aee4cf558d9c30f9ada9a59ce87 Mon Sep 17 00:00:00 2001 From: Clement Date: Mon, 14 Mar 2022 02:16:18 +0800 Subject: [PATCH] Fixed broken pubdate and added missing GUIDs --- blog/.data.json | 34 +++++++++++++++++----------------- blog/.rss.template | 8 ++++---- scripts/build-website.sh | 11 ++++++----- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/blog/.data.json b/blog/.data.json index b48673b..080c33d 100644 --- a/blog/.data.json +++ b/blog/.data.json @@ -2,86 +2,86 @@ { "title":"", "published_date":"", - "guid":"" + "guid":"599b49d9-02bb-4195-a836-d4ecab7176b6" }, { "title":"The First Entry", "published_date":"Thu, 20 Jun 2019 00:00:00 +0800", - "guid":"" + "guid":"5242211d-7d5b-4b08-a8d3-663f4179b180" }, { "title":"The Migration", "published_date":"Wed, 07 Aug 2019 00:00:00 +0800", - "guid":"" + "guid":"ccdb8b82-3d2d-40db-b53b-604fb0df331c" }, { "title":"Configuring Dynamic DNS Records", "published_date":"Thu, 29 Aug 2019 00:00:00 +0800", - "guid":"" + "guid":"147cceef-d39f-4c1a-84f9-f341f8054655" }, { "title":"? Matched Expression Does Not Match in Perl", "published_date":"Wed, 18 Sep 2019 00:00:00 +0800", - "guid":"" + "guid":"f6973140-6ceb-4ea0-a984-39ececdfec04" }, { "title":"The SBC Change", "published_date":"Mon, 02 Mar 2020 00:00:00 +0800", - "guid":"" + "guid":"e4fb48f1-8263-47b7-9284-ffded0ee172e" }, { "title":"A Hit of Kubernetes", "published_date":"Thu, 21 May 2020 00:00:00 +0800", - "guid":"" + "guid":"d3880905-251f-423b-9b9c-f3a9ca6bc48f" }, { "title":"Optimizing Web Pages and File Sizes", "published_date":"Fri, 22 May 2020 00:00:00 +0800", - "guid":"" + "guid":"af6fa2dd-0e3b-4f1e-a433-f0e2090c249c" }, { "title":"Some Website Design and CSS", "published_date":"Mon, 08 Jun 2020 00:00:00 +0800", - "guid":"" + "guid":"788b1e65-8f5f-461d-88da-74198f8e3dbd" }, { "title":"Git and Bash The Site", "published_date":"Thu, 02 Jul 2020 00:00:00 +0800", - "guid":"" + "guid":"8dc020ec-bb2a-4b6b-8d2a-de87af633a5b" }, { "title":"A Birth In The Family", "published_date":"Sun, 26 Jul 2020 00:00:00 +0800", - "guid":"" + "guid":"1b1cce91-3259-4af3-ac5d-f253bb073a5e" }, { "title":"Programming Anxiety", "published_date":"Thu, 13 Aug 2020 00:00:00 +0800", - "guid":"" + "guid":"50669054-16ba-4784-ac35-40d94fbf2667" }, { "title":"LXC and Friends", "published_date":"Thu, 20 Aug 2020 00:00:00 +0800", - "guid":"" + "guid":"1e258c76-5f58-4471-b0f3-31fdf263d2c7" }, { "title":"Migrating Everything to Proxmox - Part 1", "published_date":"Mon, 30 Nov 2020 00:00:00 +0800", - "guid":"" + "guid":"acedd608-a4cc-4c93-a894-37995d61bb65" }, { "title":"A Brief Goodbye to CentOS", "published_date":"Wed, 09 Dec 2020 00:00:00 +0800", - "guid":"" + "guid":"a9e058ac-7811-464b-8aef-735b6aa6e219" }, { "title":"A Walk Along The Side", "published_date":"Tue, 27 Jul 2021 00:00:00 +0800", - "guid":"" + "guid":"490c8b5e-c811-46e3-a3bf-6c9cfaccf8d9" }, { "title":"A Taste of Progress", "published_date":"Sat, 23 Oct 2021 00:00:00 +0800", - "guid":"" + "guid":"13dee0f1-8bb9-4f81-a8fc-2994ec4b4b33" } ]} diff --git a/blog/.rss.template b/blog/.rss.template index 18f92c7..ee4352b 100644 --- a/blog/.rss.template +++ b/blog/.rss.template @@ -4,12 +4,12 @@ https://www.clementchiew.me. en-us - $pubdate - $pubdate + PUBDATE + PUBDATE https://www.clement.chiew/blog/rss Some random bash scripts - clementchiew@disroot.org - clementchiew@disroot.org + clementchiew95@disroot.org (Clement Chiew) + clementchiew95@disroot.org (Clement Chiew) $itemlist diff --git a/scripts/build-website.sh b/scripts/build-website.sh index 37fa62d..507ceff 100755 --- a/scripts/build-website.sh +++ b/scripts/build-website.sh @@ -48,15 +48,16 @@ itemlinereplace=$(grep -n '$item' .rss.item.template | cut -f1 -d:) # build rss feed cat \ -<(head -n $(( linereplace -1 )) .rss.template) \ +<(head -n $(( linereplace -1 )) .rss.template | + sed "s/PUBDATE/$(date -R)/" ) \ <( for ((i=1;i<10;i++)) do itemnum=$(( CONTENTNUM - i )) padint=$(printf %03d $itemnum) - title=$(jq '.data | .['"$padint"'].title' .data.json ) - pubdate=$(jq '.data | .['"$padint"'].published_date' .data.json ) - guid=$(jq '.data | .['"$padint"'].guid' .data.json ) + title=$(jq -r '.data | .['"$padint"'].title' .data.json ) + pubdate=$(jq -r '.data | .['"$padint"'].published_date' .data.json ) + guid=$(jq -r '.data | .['"$padint"'].guid' .data.json ) cat \ <(head -n $(( itemlinereplace -1 )) .rss.item.template | sed "s/TITLE/$title/; @@ -64,7 +65,7 @@ cat \ ) \ <(cat content-$padint quote-$padint | tidy -q -asxml | - xq -cx '.html.body' ) \ + xq -rcx '.html.body' ) \ <(tail -n +$(( itemlinereplace +1 )) .rss.item.template | sed "s/PUBDATE/$pubdate/; s/GUID/$guid/"