From 6ea9f97e666cb3712b1060731c302ed9fd5cf7b8 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 31 Dec 2020 08:39:31 +0100 Subject: Don't include page's own metadata in added metadata --- scripts/build_content.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'scripts/build_content.sh') diff --git a/scripts/build_content.sh b/scripts/build_content.sh index 72e0956..26c936d 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh @@ -183,9 +183,9 @@ handle () { echo -e "\033[0;90m[COMPILE ]\033[0m Getting metadata" - metadata=$(get_metadata "$1") + included_metadata=$(get_metadata "$1") - create_feed=$(echo "$metadata" | jq -r ".create_feed") + create_feed=$(echo "$included_metadata" | jq -r ".create_feed") url_abs=$(get_url_abs "$1" "html") url_full="${SITE%/}$url_abs" @@ -197,10 +197,7 @@ handle () { is_home=true fi - metadata=$(echo "[ \ - $metadata, \ - $(get_subpages_meta "$1") \ - ]" | jq ".[0] + .[1] + { \ + added_metadata=$(echo "$(get_subpages_meta "$1")" | jq ". + { \ url: { \ abs: \"$url_abs\", \ full: \"$url_full\" \ @@ -215,9 +212,9 @@ handle () { if [ "$create_feed" = "true" ]; then feed_url_abs="$(get_url_abs "$1" "xml")" feed_url_full="${SITE%/}$feed_url_abs" - last_update=$(echo "$metadata" | jq -r ".pages.all[0].date") + last_update=$(echo "$added_metadata" | jq -r ".pages.all[0].date") - metadata=$(echo "$metadata" | jq ". + { \ + added_metadata=$(echo "$added_metadata" | jq ". + { \ feed: { \ last_update: $last_update, \ url: { \ @@ -228,7 +225,7 @@ handle () { }") fi - echo "$metadata" > "$meta_file" + echo "$added_metadata" > "$meta_file" if [ "$create_feed" = "true" ]; then echo -e "\033[0;90m[COMPILE ]\033[0m Creating feed" -- cgit v1.2.3-70-g09d2