summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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."