From: Lucian Mogosanu Date: Wed, 17 Jul 2013 15:14:50 +0000 (+0300) Subject: site: compile posts X-Git-Tag: v0.1~47 X-Git-Url: https://git.mogosanu.ro/?a=commitdiff_plain;h=d12848d9b343bbbb2551e9bf5f23fea461805379;p=thetarpit.git site: compile posts --- diff --git a/site.hs b/site.hs index 04c614f..4073dba 100644 --- a/site.hs +++ b/site.hs @@ -4,7 +4,12 @@ import Hakyll main :: IO () main = hakyll $ do - match "index.html" $ do + match "index.html" compileIndex + match "posts/*" compilePosts + match "templates/*" $ compile templateCompiler + +compileIndex :: Rules () +compileIndex = do route idRoute -- TODO: make a "copy to root" route? compile $ do let indexCtx = defaultContext @@ -14,4 +19,12 @@ main = hakyll $ do >>= loadAndApplyTemplate "templates/default.html" indexCtx >>= relativizeUrls - match "templates/*" $ compile templateCompiler +compilePosts :: Rules () +compilePosts = do + route $ setExtension "html" + compile $ pandocCompiler + >>= loadAndApplyTemplate "templates/default.html" postCtx + >>= relativizeUrls + +postCtx :: Context String +postCtx = dateField "date" "$B %e, %Y" `mappend` defaultContext