summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-03-08 19:04:53 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-03-08 19:04:53 +0100
commit64b640f97d00c119ef4ed4c8ccf8e588226bfcad (patch)
tree94e6d9c4ec3aa852268b4c4046a51bdcc05c4a71
parentd023eb5bf66bd45c1460c9dd331af409d8294763 (diff)
downloadhakyll-64b640f97d00c119ef4ed4c8ccf8e588226bfcad.tar.gz
Added RSS date for items.
-rw-r--r--data/templates/rss-item.xml1
-rw-r--r--src/Text/Hakyll/Rss.hs10
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>$title</title>
<link>$absolute/$url</link>
<description>$description</description>
+ <pubDate>$timestamp</pubDate>
</item>
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."