From 64b640f97d00c119ef4ed4c8ccf8e588226bfcad Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Mon, 8 Mar 2010 19:04:53 +0100 Subject: Added RSS date for items. --- data/templates/rss-item.xml | 1 + src/Text/Hakyll/Rss.hs | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/data/templates/rss-item.xml b/data/templates/rss-item.xml index 2166a25..794a036 100644 --- a/data/templates/rss-item.xml +++ b/data/templates/rss-item.xml @@ -2,4 +2,5 @@ $title $absolute/$url $description + $timestamp diff --git a/src/Text/Hakyll/Rss.hs b/src/Text/Hakyll/Rss.hs index 5f1d867..992e965 100644 --- a/src/Text/Hakyll/Rss.hs +++ b/src/Text/Hakyll/Rss.hs @@ -5,12 +5,13 @@ module Text.Hakyll.Rss ( RssConfiguration (..) , renderRss , renderRssWith + , renderRssDate ) where import Control.Arrow ((>>>), second) import Control.Monad.Reader (liftIO) -import Text.Hakyll.Context (ContextManipulation) +import Text.Hakyll.Context (ContextManipulation, renderDate) import Text.Hakyll.Hakyll (Hakyll) import Text.Hakyll.Render (render, renderChain) import Text.Hakyll.Renderables (createListingWith) @@ -72,6 +73,11 @@ renderRssWith :: ContextManipulation -- ^ Manipulation to apply on the items. renderRssWith manipulation configuration renderables = do template <- liftIO $ getDataFileName "templates/rss.xml" itemTemplate <- liftIO $ getDataFileName "templates/rss-item.xml" - let renderRssWith' = createRssWith manipulation configuration + let renderRssWith' = createRssWith manipulation' configuration renderables template itemTemplate renderChain [] renderRssWith' + where + manipulation' = manipulation . renderRssDate + +renderRssDate :: ContextManipulation +renderRssDate = renderDate "timestamp" "%a, %d %b %Y %H:%M:%S %Z" "No date found." -- cgit v1.2.3