summaryrefslogtreecommitdiff
path: root/examples/tagblog
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-03-30 19:25:22 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-03-30 19:25:22 +0200
commit622c259708503eb9eb766fe0b00c28b979e2e653 (patch)
tree8289d95ab3afca4b7540f8207800c1e37db5ffdd /examples/tagblog
parent82931dd6661221f1d138f2de5af0668e9080ef26 (diff)
downloadhakyll-622c259708503eb9eb766fe0b00c28b979e2e653.tar.gz
Adapted examples to general style guide.
Because I thought the examples should follow the same style guidelines as the Hakyll code itself, I adapted them to it.
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"