From 59bfd90c13f1f95a3443c3a167d49af4175a7c26 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 31 Dec 2020 18:04:32 +0100 Subject: Add last_update metadata to pages --- scripts/build_content.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/build_content.sh b/scripts/build_content.sh index a57feed..17532f5 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh @@ -122,6 +122,17 @@ get_subpages_meta() { date_rfc3339=$(date -d "$date" --rfc-3339=seconds | sed 's/ /T/') fi + last_update=$(echo "$metadata" | jq -r .last_update) + last_update_rfc3339="" + + if [ "$last_update" != "" ]; then + last_update=$date + fi + + if [ "$last_update" != "" ]; then + last_update_rfc3339=$(date -d "$last_update" --rfc-3339=seconds | sed 's/ /T/') + fi + category=$(echo "$metadata" | jq -r .category) category_name="" @@ -140,6 +151,10 @@ get_subpages_meta() { yyyy_mm_dd: \"$date\", \ rfc3339: \"$date_rfc3339\" \ }, \ + last_update: { \ + yyyy_mm_dd: \"$last_update\", \ + rfc3339: \"$last_update_rfc3339\" \ + }, \ url: { \ rel: \"$url_rel\", \ abs: \"$url_abs\", \ @@ -217,7 +232,7 @@ handle () { if [ "$create_feed" = "true" ]; then feed_url_abs="$(get_url_abs "$1" "xml")" feed_url_full="${SITE%/}$feed_url_abs" - last_update=$(echo "$added_metadata" | jq -r ".pages.all[0].date") + last_update=$(echo "$added_metadata" | jq -r ".pages.all[0].last_update") added_metadata=$(echo "$added_metadata" | jq ". + { \ feed: { \ -- cgit v1.2.3-70-g09d2