summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-03-08 22:54:41 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-03-08 22:54:41 +0100
commit4756b82329a086ad6666ccc8578c0cb1d14873e3 (patch)
treeff41ac8b55145fb8238cf25604853cdd11fe87b9 /src
parent45459c3a2086aa47f35b90ecc5e658fdc72e7982 (diff)
downloadhakyll-4756b82329a086ad6666ccc8578c0cb1d14873e3.tar.gz
Documented Text.Hakyll.Feed.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Hakyll/Feed.hs35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/Text/Hakyll/Feed.hs b/src/Text/Hakyll/Feed.hs
index 08f246d..0d153a3 100644
--- a/src/Text/Hakyll/Feed.hs
+++ b/src/Text/Hakyll/Feed.hs
@@ -1,6 +1,22 @@
-- | A Module that allows easy rendering of RSS feeds. If you use this module,
-- you must make sure you set the `absoluteUrl` field in the main Hakyll
-- configuration.
+--
+-- Apart from that, the main rendering functions (@renderRss@,
+-- @renderRssWith@, @renderAtom@ all @renderAtomWith@) all assume that you
+-- pass the list of @Renderable@s so that the most recent entry in the feed is
+-- the first item in the list.
+--
+-- Also note that the @Renderable@s should have (at least) the following
+-- fields to produce a correct feed:
+--
+-- - @$title@: Title of the item.
+--
+-- - @$description@: Description to appear in the feed.
+--
+-- - @$url@: URL to the item - this is usually set automatically.
+--
+-- Furthermore, the feed will not validate if an empty list is passed.
module Text.Hakyll.Feed
( FeedConfiguration (..)
, renderRss
@@ -77,17 +93,8 @@ renderFeedWith manipulation configuration renderables template itemTemplate = do
renderChain [] renderFeedWith'
-- | Render an RSS feed with a number of items.
---
--- Note that the @Renderable@s should have the following fields:
---
--- - @$title@: Title of the item.
---
--- - @$description@: Description to appear in the feed.
---
--- - @$url@: URL to the item - this is usually set automatically.
---
renderRss :: FeedConfiguration -- ^ Feed configuration.
- -> [Renderable] -- ^ Items to include in the feed.
+ -> [Renderable] -- ^ Items to include in the RSS feed.
-> Hakyll ()
renderRss = renderRssWith id
@@ -105,14 +112,19 @@ renderRssWith manipulation configuration renderables =
where
manipulation' = manipulation . renderRssDate
+-- | @ContextManipulation@ that renders a date to RSS format.
renderRssDate :: ContextManipulation
-renderRssDate = renderDate "timestamp" "%a, %d %b %Y %H:%M:%S UT" "No date found."
+renderRssDate = renderDate "timestamp" "%a, %d %b %Y %H:%M:%S UT"
+ "No date found."
+-- | Render an Atom feed with a number of items.
renderAtom :: FeedConfiguration
-> [Renderable]
-> Hakyll ()
renderAtom = renderAtomWith id
+-- | A version of @renderAtom@ that allows you to specify a manipulation to
+-- apply on the @Renderable@s.
renderAtomWith :: ContextManipulation -- ^ Manipulation to apply on the items.
-> FeedConfiguration -- ^ Feed configuration.
-> [Renderable] -- ^ Items to include in the feed.
@@ -123,5 +135,6 @@ renderAtomWith manipulation configuration renderables =
where
manipulation' = manipulation . renderAtomDate
+-- | Render a date to Atom format.
renderAtomDate :: ContextManipulation
renderAtomDate = renderDate "timestamp" "%Y-%m-%dT%H:%M:%SZ" "No date found."