@@ -10,7 +10,7 @@ import Text.Hakyll.CreateContext (createPage, createCustomPage, createListing)
1010import Text.Hakyll.ContextManipulations (renderDate, copyValue, changeValue)
1111import Text.Hakyll.Util (link)
1212import Data.Map (toList)
13−import Control.Monad (mapM_, liftM, (<=<))
13+import Control.Monad (forM_, liftM, (<=<))
1414import Data.Either (Either(..))
1515
1616main = hakyll "http://example.com" $ do
@@ -34,38 +34,43 @@ main = hakyll "http://example.com" $ do
3434 withTagMap categoryMap renderListForCategory
3535
3636 -- Render index, including recent posts.
37+ let categoryList' = categoryMap >>> categoryList
3738 let index = createListing "index.html"
3839 ["templates/postitem.html"]
3940 (take 3 renderablePosts)
4041 [ ("title", Left "Home")
41− , ("categories", Right $ categoryMap >>> categoryList)
42+ , ("categories", Right $ categoryList')
4243 ]
4344 renderChain ["index.html", "templates/default.html"] index
4445
4546 -- Render all posts.
46− mapM_ (renderChain ["templates/post.html"
47− ,"templates/default.html"
48− ]) renderablePosts
47+ forM_ renderablePosts $ renderChain [ "templates/post.html"
48+ , "templates/default.html"
49+ ]
4950
5051 -- Render rss feed
5152 renderRss myFeedConfiguration $
5253 map (>>> copyValue "body" "description") (take 3 renderablePosts)
5354
54− where postManipulation = renderDate "date" "%B %e, %Y" "Date unknown"
55− >>> renderCategoryLink
55+ where
56+ postManipulation = renderDate "date" "%B %e, %Y" "Date unknown"
57+ >>> renderCategoryLink
5658
57− renderCategoryLink = changeValue "category" (\c -> link c $ categoryToUrl c)
59+ renderCategoryLink =
60+ changeValue "category" (\c -> link c $ categoryToUrl c)
5861
59− categoryToUrl category = "$root/categories/" ++ removeSpaces category ++ ".html"
62+ categoryToUrl c = "$root/categories/" ++ removeSpaces c ++ ".html"
6063
61− categoryList = arr $ uncurry categoryListItem <=< toList
64+ categoryList = arr $ uncurry categoryListItem <=< toList
6265
63− categoryListItem category posts = "<li>" ++ link category (categoryToUrl category)
64− ++ " - " ++ show (length posts) ++ " items.</li>"
66+ categoryListItem category posts =
67+ "<li>" ++ link category (categoryToUrl category)
68+ ++ " - " ++ show (length posts) ++ " items.</li>"
6569
66− renderPostList url title posts = do
67− let list = createListing url ["templates/postitem.html"] posts [("title", Left title)]
68− renderChain ["posts.html", "templates/default.html"] list
70+ renderPostList url title posts = do
71+ let list = createListing url ["templates/postitem.html"]
72+ posts [("title", Left title)]
73+ renderChain ["posts.html", "templates/default.html"] list
6974
7075myFeedConfiguration = FeedConfiguration
7176 { feedUrl = "rss.xml"