on master help sign in
Added RSS date for items.
commit64b640f97d00c119ef4ed4c8ccf8e588226bfcad authorJasper Van der Jeugt <jaspervdj@gmail.com> dateMon 8 Mar 2010, 19:04 (17 years ago) parentd023eb5
2 files changed+9−2
data/templates/rss-item.xml+1 src/Text/Hakyll/Rss.hs+8−2
data/templates/rss-item.xml+1
@@ -2,4 +2,5 @@
22 <title>$title</title>
33 <link>$absolute/$url</link>
44 <description>$description</description>
5+ <pubDate>$timestamp</pubDate>
56</item>
src/Text/Hakyll/Rss.hs+8−2
@@ -5,12 +5,13 @@ module Text.Hakyll.Rss
55 ( RssConfiguration (..)
66 , renderRss
77 , renderRssWith
8+ , renderRssDate
89 ) where
910
1011import Control.Arrow ((>>>), second)
1112import Control.Monad.Reader (liftIO)
1213
13−import Text.Hakyll.Context (ContextManipulation)
14+import Text.Hakyll.Context (ContextManipulation, renderDate)
1415import Text.Hakyll.Hakyll (Hakyll)
1516import Text.Hakyll.Render (render, renderChain)
1617import Text.Hakyll.Renderables (createListingWith)
@@ -72,6 +73,11 @@ renderRssWith :: ContextManipulation -- ^ Manipulation to apply on the items.
7273renderRssWith manipulation configuration renderables = do
7374 template <- liftIO $ getDataFileName "templates/rss.xml"
7475 itemTemplate <- liftIO $ getDataFileName "templates/rss-item.xml"
75− let renderRssWith' = createRssWith manipulation configuration
76+ let renderRssWith' = createRssWith manipulation' configuration
7677 renderables template itemTemplate
7778 renderChain [] renderRssWith'
79+ where
80+ manipulation' = manipulation . renderRssDate
81+
82+renderRssDate :: ContextManipulation
83+renderRssDate = renderDate "timestamp" "%a, %d %b %Y %H:%M:%S %Z" "No date found."