From 75ba4fc4a55e980b20480e370a963939139c1ea5 Mon Sep 17 00:00:00 2001 From: Lucian Mogosanu Date: Sat, 24 Aug 2013 08:47:56 +0300 Subject: [PATCH] site: index: render taglist field --- index.html | 2 +- site.hs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index d2bd043..814c515 100644 --- a/index.html +++ b/index.html @@ -10,4 +10,4 @@ $partial("templates/post-list.html")$

Labels

-TODO +$taglist$ diff --git a/site.hs b/site.hs index 89d02a7..bc6954d 100644 --- a/site.hs +++ b/site.hs @@ -13,7 +13,7 @@ main = hakyllWith tarpitConfiguration $ do tags <- buildTags "posts/**" $ fromCapture "tags/*.html" -- content - match "index.html" compileIndex + match "index.html" $ compileIndex tags match "css/*" compileCss match "posts/**" $ compilePosts tags match "images/**" $ compileImages @@ -31,13 +31,14 @@ main = hakyllWith tarpitConfiguration $ do match "templates/*" $ compile templateCompiler -- compilers go here -compileIndex :: Rules () -compileIndex = do +compileIndex :: Tags -> Rules () +compileIndex tags = do route idRoute -- TODO: make a "copy to root" route? compile $ do posts <- loadAll "posts/**" >>= fmap (take 5) . recentFirst let indexCtx = - listField "posts" postCtx (return posts) `mappend` + listField "posts" postCtx (return posts) `mappend` + field "taglist" (const $ renderTagList tags) `mappend` defaultContext getResourceBody -- 1.7.10.4