From: Lucian Mogosanu Date: Sat, 24 Aug 2013 05:47:56 +0000 (+0300) Subject: site: index: render taglist field X-Git-Tag: v0.2~6^2~3 X-Git-Url: https://git.mogosanu.ro/?a=commitdiff_plain;h=75ba4fc4a55e980b20480e370a963939139c1ea5;p=thetarpit.git site: index: render taglist field --- 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