@@ -1,4 +1,6 @@
1−-- | A Module that allows easy rendering of RSS feeds.
1+-- | A Module that allows easy rendering of RSS feeds. If you use this module,
2+-- you must make sure you set the `absoluteUrl` field in the main Hakyll
3+-- configuration.
24module Text.Hakyll.Rss
35 ( RssConfiguration (..)
46 , renderRss
@@ -16,6 +18,7 @@ import Text.Hakyll.RenderAction (Renderable)
1618
1719import Paths_hakyll
1820
21+-- | This is a data structure to keep the configuration of an RSS feed.
1922data RssConfiguration = RssConfiguration
2023 { -- | Url of the RSS feed (relative to site root). For example, @rss.xml@.
2124 rssUrl :: String
@@ -25,11 +28,13 @@ data RssConfiguration = RssConfiguration
2528 rssDescription :: String
2629 }
2730
28−createRssWith :: ContextManipulation
29− -> RssConfiguration
30− -> [Renderable]
31− -> FilePath
32− -> FilePath
31+-- | This is an auxiliary function to create a listing that is, in fact, an RSS
32+-- feed.
33+createRssWith :: ContextManipulation -- ^ Manipulation to apply on the items.
34+ -> RssConfiguration -- ^ Feed configuration.
35+ -> [Renderable] -- ^ Items to include.
36+ -> FilePath -- ^ RSS feed template.
37+ -> FilePath -- ^ RSS item template.
3338 -> Renderable
3439createRssWith manipulation configuration renderables template itemTemplate =
3540 listing >>> render template
@@ -42,12 +47,18 @@ createRssWith manipulation configuration renderables template itemTemplate =
4247 , ("description", rssDescription)
4348 ]
4449
45−renderRss :: RssConfiguration -> [Renderable] -> Hakyll ()
50+-- | Render an RSS feed with a number of items.
51+renderRss :: RssConfiguration -- ^ Feed configuration.
52+ -> [Renderable] -- ^ Items to include in the feed.
53+ -> Hakyll ()
4654renderRss = renderRssWith id
4755
48−renderRssWith :: ContextManipulation
49− -> RssConfiguration
50− -> [Renderable]
56+-- | Render an RSS feed with a number of items. This function allows you to
57+-- specify a @ContextManipulation@ which will be applied on every
58+-- @Renderable@.
59+renderRssWith :: ContextManipulation -- ^ Manipulation to apply on the items.
60+ -> RssConfiguration -- ^ Feed configuration.
61+ -> [Renderable] -- ^ Items to include in the feed.
5162 -> Hakyll ()
5263renderRssWith manipulation configuration renderables = do
5364 template <- liftIO $ getDataFileName "templates/rss.xml"