match "images/**" $ compileImages
match "css/fonts/*" $ compileFonts
match (fromList pages) compilePages
- create ["archive.html"] compileArchive
+ create ["archive.html"] $ compileArchive tags
-- tags rules
tagsRules tags $ compileTags tags
posts <- loadAll "posts/**" >>= fmap (take 5) . recentFirst
let indexCtx =
listField "posts" postCtx (return posts) `mappend`
- field "taglist" (const $ renderTagList tags) `mappend`
defaultContext
getResourceBody
-- relative URLs break 404 pages, so don't do it here
-- >>= relativizeUrls
-compileArchive :: Rules ()
-compileArchive = do
+compileArchive :: Tags -> Rules ()
+compileArchive tags = do
route idRoute
compile $ do
posts <- loadAll "posts/**" >>= recentFirst
let archiveCtx =
- listField "posts" postCtx (return posts) `mappend`
- constField "title" "Archive" `mappend`
+ listField "posts" postCtx (return posts) `mappend`
+ field "taglist" (const $ renderTagList tags) `mappend`
+ constField "title" "Archive" `mappend`
defaultContext
makeItem ""
>>= loadAndApplyTemplate "templates/archive.html" archiveCtx