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
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