diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-01-27 12:51:11 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-01-27 12:51:11 +0100 |
commit | dc516e9665f8245fb126c9e6b5361363395f502a (patch) | |
tree | 5a3056a7973cce41083c5d338d8acd660feffa2f | |
parent | cf2c4ad77c73352d1ea065323e6e1c2d304040dd (diff) | |
download | hakyll-dc516e9665f8245fb126c9e6b5361363395f502a.tar.gz |
Updated examples and tutorials.
-rw-r--r-- | examples/hakyll/tutorial5.markdown | 16 | ||||
-rw-r--r-- | examples/tagblog/hakyll.hs | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/examples/hakyll/tutorial5.markdown b/examples/hakyll/tutorial5.markdown index fc7d17b..371d2ca 100644 --- a/examples/hakyll/tutorial5.markdown +++ b/examples/hakyll/tutorial5.markdown @@ -159,14 +159,16 @@ post lists for every tag. Hakyll provides a function called `readTagMap`. Let's inspect it's type. ~~~~~{.haskell} -readTagMap [FilePath] -> Hakyll Map String [FilePath] +readTagMap String [FilePath] -> Hakyll Map String [FilePath] ~~~~~ You give it a list of paths, and it creates a map that, for every tag, holds a number of posts. We can easily use this to render a post list for every tag. +The first argument given is an "identifier", unique to this tag map. Hakyll +needs this so it can cache the tags. ~~~~~{.haskell} -tagMap <- readTagMap postPaths +tagMap <- readTagMap "postTags" postPaths let renderListForTag (tag, posts) = renderPostList (tagToURL tag) ("Posts tagged " ++ tag) @@ -181,11 +183,11 @@ A tag cloud is a commonly found thing on blogs. Hakyll also provides code to generate a tag cloud. Let's have a look at the `renderTagCloud` function. ~~~~~{.haskell} -TagCloud :: M.Map String [FilePath] - -> (String -> String) - -> Float - -> Float - -> String +renderTagCloud :: M.Map String [FilePath] + -> (String -> String) + -> Float + -> Float + -> String ~~~~~ The first argument is obviously the result of the `readTagMap` function. The diff --git a/examples/tagblog/hakyll.hs b/examples/tagblog/hakyll.hs index df5e9d0..dcbb943 100644 --- a/examples/tagblog/hakyll.hs +++ b/examples/tagblog/hakyll.hs @@ -20,7 +20,7 @@ main = hakyll $ do let renderablePosts = map createPagePath postPaths -- Read tag map. - tagMap <- readTagMap postPaths + tagMap <- readTagMap "postTags" postPaths -- Render all posts list. renderPostList "posts.html" "All posts" postPaths |