summaryrefslogtreecommitdiff
path: root/examples/tagblog
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tagblog')
-rw-r--r--examples/tagblog/hakyll.hs29
1 files changed, 16 insertions, 13 deletions
diff --git a/examples/tagblog/hakyll.hs b/examples/tagblog/hakyll.hs
index 4c6b89c..a81c280 100644
--- a/examples/tagblog/hakyll.hs
+++ b/examples/tagblog/hakyll.hs
@@ -10,7 +10,7 @@ import Text.Hakyll.CreateContext (createPage, createCustomPage, createListing)
import Text.Hakyll.ContextManipulations (renderDate, copyValue)
import Data.List (sort)
import Data.Map (toList)
-import Control.Monad (mapM_, liftM)
+import Control.Monad (forM_, liftM)
import Data.Either (Either(..))
main = hakyll "http://example.com" $ do
@@ -28,9 +28,10 @@ main = hakyll "http://example.com" $ do
renderPostList "posts.html" "All posts" renderablePosts
-- Render post list per tag
- let renderListForTag tag posts = renderPostList (tagToUrl tag) ("Posts tagged " ++ tag)
- (map (>>> postManipulation) posts)
- withTagMap tagMap renderPostList
+ let renderListForTag tag posts =
+ renderPostList (tagToUrl tag) ("Posts tagged " ++ tag)
+ (map (>>> postManipulation) posts)
+ withTagMap tagMap renderListForTag
-- Render index, including recent posts.
let tagCloud = tagMap >>> renderTagCloud tagToUrl 100 200
@@ -43,22 +44,24 @@ main = hakyll "http://example.com" $ do
renderChain ["index.html", "templates/default.html"] index
-- Render all posts.
- mapM_ (renderChain ["templates/post.html"
- ,"templates/default.html"
- ]) renderablePosts
+ forM_ renderablePosts $ renderChain [ "templates/post.html"
+ , "templates/default.html"
+ ]
-- Render rss feed
renderRss myFeedConfiguration $
map (>>> copyValue "body" "description") (take 3 renderablePosts)
- where postManipulation = renderDate "date" "%B %e, %Y" "Date unknown"
- >>> renderTagLinks tagToUrl
+ where
+ postManipulation = renderDate "date" "%B %e, %Y" "Date unknown"
+ >>> renderTagLinks tagToUrl
- tagToUrl tag = "$root/tags/" ++ removeSpaces tag ++ ".html"
+ tagToUrl tag = "$root/tags/" ++ removeSpaces tag ++ ".html"
- renderPostList url title posts = do
- let list = createListing url ["templates/postitem.html"] posts [("title", Left title)]
- renderChain ["posts.html", "templates/default.html"] list
+ renderPostList url title posts = do
+ let list = createListing url ["templates/postitem.html"]
+ posts [("title", Left title)]
+ renderChain ["posts.html", "templates/default.html"] list
myFeedConfiguration = FeedConfiguration
{ feedUrl = "rss.xml"