summaryrefslogtreecommitdiff
path: root/examples/categoryblog
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-29 18:36:54 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2010-01-29 18:36:54 +0100
commit340b87899dfd1b4cc223777991593444be76ad02 (patch)
tree1f463ebf542fcd8bbfd0214f720ec72b382990fb /examples/categoryblog
parentc49cc9a046aef1f42564857b08c19ed43dd3f263 (diff)
downloadhakyll-340b87899dfd1b4cc223777991593444be76ad02.tar.gz
Added a category tutorial.
Diffstat (limited to 'examples/categoryblog')
-rw-r--r--examples/categoryblog/hakyll.hs8
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)