ferron

Ferron is a fast and simple static website generator made with Lua.
Log | Files | Refs | Submodules | README | LICENSE

commit 5894a02e8232eb371df533a75a8d7735a1788f57
parent 05eaa44d521fea71e29cc10e369ad4351d281538
Author: Hugo Soucy <hugo.soucy@savoirfairelinux.com>
Date:   Fri, 26 Jan 2018 12:19:53 -0500

Put a mecanism to create RSS 2 feed.

Diffstat:
Mfunctions/make-atom-feed.lua | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/functions/make-atom-feed.lua b/functions/make-atom-feed.lua @@ -7,8 +7,10 @@ local templateutils = require("functions.template-utils") local function makeatomfeed() local feed = {} local feedtemplate = path.isfile(Ferron.site.path .. Ferron.site.config.SITE.PATHS.TEMPLATES .. "/feed.mustache") + local feedrsstemplate = path.isfile(Ferron.site.path .. Ferron.site.config.SITE.PATHS.TEMPLATES .. "/rss2.mustache") local feedpartials = path.isdir(Ferron.site.path .. Ferron.site.config.SITE.PATHS.TEMPLATES .. "/partials") local feedfile = Ferron.site.path .. Ferron.site.config.SITE.PATHS.HTML .. "/feed.atom.xml" + local feedrssfile = Ferron.site.path .. Ferron.site.config.SITE.PATHS.HTML .. "/feed.rss.xml" print("§ Make an ATOM feed with all the pages of the site:") @@ -31,6 +33,16 @@ local function makeatomfeed() ) ) + -- Build the RSS 2 XML file + fileutils.pushfilecontent( + feedrssfile, + templateutils.setmustache( + fileutils.pullfilecontent(feedrsstemplate), + feedpartials, + feed + ) + ) + if path.isfile(feedfile) ~= false then print(" ¬ /feed.atom.xml - created") else