Following two match statements are my favourite parts of my site.hs
.
"about.rst", "contact.markdown", "cv.rst"]) $ do
match (fromList [$ setExtension "html"
route $ pandocMathCompiler
compile >>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
"posts/*" .&&. (complement "posts/*.draft.*")) $ do
match ($ setExtension "html"
route $ pandocMathCompiler
compile >>= loadAndApplyTemplate "templates/post.html" postCtx
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
(complement "posts/*.draft.*")
filters out every post with draft file extension followed by that of its original. Editing site.hs
like this reminds me the time when I was using dwm. If you want something to be different, you don’t work with configuration file read by the system, you just change the C header file and recompile it. Same principle works for Hakyll as well, also more systemically and cleanly, thanks to its monadic interface.
By the way the first match
is describing the LaTeX compilation process (pandocMathCompiler
is well-defined above in my source).
Planning to make the blog repository public someday to share my modifications.