diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-01-29 18:36:54 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2010-01-29 18:36:54 +0100 |
commit | 340b87899dfd1b4cc223777991593444be76ad02 (patch) | |
tree | 1f463ebf542fcd8bbfd0214f720ec72b382990fb /examples/categoryblog | |
parent | c49cc9a046aef1f42564857b08c19ed43dd3f263 (diff) | |
download | hakyll-340b87899dfd1b4cc223777991593444be76ad02.tar.gz |
Added a category tutorial.
Diffstat (limited to 'examples/categoryblog')
-rw-r--r-- | examples/categoryblog/hakyll.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/categoryblog/hakyll.hs b/examples/categoryblog/hakyll.hs index 2fef98e..e6d87ea 100644 --- a/examples/categoryblog/hakyll.hs +++ b/examples/categoryblog/hakyll.hs @@ -2,12 +2,11 @@ module Main where import Text.Hakyll (hakyll) import Text.Hakyll.Render -import Text.Hakyll.Tags (readCategoryMap) -import Text.Hakyll.File (getRecursiveContents, directory, removeSpaces) +import Text.Hakyll.Tags (TagMap, readCategoryMap) +import Text.Hakyll.File (getRecursiveContents, directory, removeSpaces, sortByBaseName) import Text.Hakyll.Renderables (createPagePath, createCustomPage, createListingWith, createListing) import Text.Hakyll.Context (ContextManipulation, renderDate) import Text.Hakyll.Util (link) -import Data.List (sort) import Data.Map (toList) import Control.Monad (mapM_, liftM, (<=<)) import Data.Either (Either(..)) @@ -17,7 +16,7 @@ main = hakyll $ do directory css "css" -- Find all post paths. - postPaths <- liftM (reverse . sort) $ getRecursiveContents "posts" + postPaths <- liftM (reverse . sortByBaseName) $ getRecursiveContents "posts" let renderablePosts = map createPagePath postPaths -- Read category map. @@ -54,6 +53,7 @@ main = hakyll $ do categoryToURL category = "$root/categories/" ++ removeSpaces category ++ ".html" + categoryList :: TagMap -> String categoryList = uncurry categoryListItem <=< toList categoryListItem category posts = "<li>" ++ link category (categoryToURL category) |