hugosoucycc

[ARCHIVED] Another old source code of <hugo.soucy.cc>.
Log | Files | Refs | Submodules

commit 275370b76f0388cc3db6d3dddc7577f21c15ba20
parent a7312e4e515098d71d19a0566c057528072d31ad
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Tue,  6 Jun 2017 22:39:17 -0400

Recreate a valid atom feed without pandoc

Diffstat:
Mfunctions/create-feed | 12+++++-------
Mtemplates/mustache/feed/feed-entry.mustache | 9+++------
Mtemplates/mustache/feed/feed.mustache | 14+++++++++-----
3 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/functions/create-feed b/functions/create-feed @@ -11,14 +11,12 @@ create_feed () { mo "$TPL_MUSTACHE_PATH/feed/feed-entry.mustache" - done < "$FAKESTACHE_PATH"/"$DB" > feed.atom.xhtml + done < "$FAKESTACHE_PATH"/"$DB" > feed.atom.inc.xml - # Build the feed with Pandoc from the `feed.atom.xhtml` file - pandoc -t html "$FAKESTACHE_PATH/feed.atom.xhtml" -s \ - --template="$TPL_PANDOC_PATH/feed.txt" \ - -o "$PUBLICHTML/feed.atom.xml" \ - --parse-raw + local feed_entries=$(cat "$FAKESTACHE_PATH/feed.atom.inc.xml") + + mo "$TPL_MUSTACHE_PATH/feed/feed.mustache" > "$PUBLICHTML/feed.atom.xml" # Then remove it when the feed is created - rm "$FAKESTACHE_PATH/feed.atom.xhtml" + rm "$FAKESTACHE_PATH/feed.atom.inc.xml" } diff --git a/templates/mustache/feed/feed-entry.mustache b/templates/mustache/feed/feed-entry.mustache @@ -1,9 +1,6 @@ <entry> <title>{{ field_title }}</title> - <link href="{{ field_permalink }}" /> - <updated>{{ field_date}}T{{ field_datetime }}</updated> - <author> - <name>{{ SITE_AUTHOR }}</name> - <email>{{ SITE_AUTHOR_EMAIL }}</email> - </author> + <id>{{ field_id }}</id> + <link href="{{ field_permalink }}" hreflang="{{ SITE_LANGUAGE }}" rel="alternate" /> + <updated>{{ field_date}}T{{ field_datetime }}Z</updated> </entry> diff --git a/templates/mustache/feed/feed.mustache b/templates/mustache/feed/feed.mustache @@ -2,10 +2,14 @@ <feed xmlns="http://www.w3.org/2005/Atom"> <title>Flux Atom de {{ SITE_DOMAINNAME }}</title> <subtitle>{{ SITE_DESCRIPTION }}</subtitle> - <link href="{{ SITE_URL }}/feed.atom.xml" rel="self" /> - <link href="{{ SITE_URL }}" /> - <updated>{{ NOW_DATE }}T{{ NOW_DATETIME }}</updated> + <id>tag:hugo.soucy.cc,2014-02-19:hs0ucy</id> + <link href="{{ SITE_URL }}/feed.atom.xml" rel="self" type="application/atom+xml"/> + <link href="{{ SITE_URL }}" rel="alternate" /> + <updated>{{ NOW_DATE }}T{{ NOW_DATETIME }}Z</updated> + <author> + <name>{{ SITE_AUTHOR }}</name> + <email>{{ SITE_AUTHOR_EMAIL }}</email> + </author> - {{ main_content }} - <!-- End of the feed --> + {{ feed_entries }} </feed>