From ec4ebdaf7c720a339252521e6f1032876fcb3683 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Wed, 30 Dec 2020 14:04:18 +0100 Subject: Store list of feeds in metadata file --- metadata/metadata.yaml | 4 ++++ scripts/build_content.sh | 9 ++++----- templates/base.html | 9 ++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/metadata/metadata.yaml b/metadata/metadata.yaml index 7d30a2a..c060e79 100644 --- a/metadata/metadata.yaml +++ b/metadata/metadata.yaml @@ -13,3 +13,7 @@ menus: - id: blog label: Blog url: /blog/ + +feeds: + - title: Blog + url: /blog/index.xml diff --git a/scripts/build_content.sh b/scripts/build_content.sh index e57cfed..6250fe9 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh @@ -213,7 +213,6 @@ handle () { create_feed=$(echo "$metadata" | jq -r ".create_feed") if [ "$create_feed" = "true" ]; then - feed_target_file="${target_file%.html}.xml" feed_url_abs="$(target_url_abs "$1" "xml")" feed_url_full="${SITE%/}$feed_url_abs" last_update=$(echo "$metadata" | jq -r ".pages.all[0].date") @@ -227,21 +226,21 @@ handle () { } \ } \ }") + fi - echo "$metadata" > "$meta_file" + echo "$metadata" > "$meta_file" + if [ "$create_feed" = "true" ]; then pandoc "$1" \ -f markdown \ -t html5 \ --template "${TEMPLATES_DIR}feed.xml" \ - -o "$feed_target_file" \ + -o "${target_file%.html}.xml" \ --metadata-file metadata/metadata.yaml \ --metadata-file "$meta_file" \ $FILTERS fi - echo "$metadata" > "$meta_file" - pandoc "$1" \ -f markdown \ -t html5 \ diff --git a/templates/base.html b/templates/base.html index e11ed5d..0856b47 100644 --- a/templates/base.html +++ b/templates/base.html @@ -15,9 +15,12 @@ $if(keywords)$ $endif$ - $if(feed.url.abs)$ - - $endif$ + $-- $if(feed.url.abs)$ + $-- + $-- $endif$ + $for(feeds)$ + + $endfor$ $if(is_home)$$else$$title$ – $endif$$site.title$ $if(section.id)$ -- cgit v1.2.3-70-g09d2