site: index: render taglist field
authorLucian Mogosanu <lucian.mogosanu@gmail.com>
Sat, 24 Aug 2013 05:47:56 +0000 (08:47 +0300)
committerLucian Mogosanu <lucian.mogosanu@gmail.com>
Sat, 24 Aug 2013 05:47:56 +0000 (08:47 +0300)
index.html
site.hs

index d2bd043..814c515 100644 (file)
@@ -10,4 +10,4 @@ $partial("templates/post-list.html")$
 
 <h2>Labels</h2>
 
-TODO
+$taglist$
diff --git a/site.hs b/site.hs
index 89d02a7..bc6954d 100644 (file)
--- 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