{-# LANGUAGE OverloadedStrings #-}

import qualified GHC.IO.Encoding as E
import Data.Monoid (mappend)
import Hakyll

main :: IO ()
main = do
  E.setLocaleEncoding E.utf8
  hakyll $ do
    match "assets/css/*" $ do
      route idRoute
      compile compressCssCompiler

    match "assets/images/*" $ do
      route idRoute
      compile copyFileCompiler

    match "index.md" $ do
      route $ setExtension "html"
      compile $ pandocCompiler
        >>= loadAndApplyTemplate "index.html" defaultContext
        >>= relativizeUrls

    match "index.html" $ compile templateBodyCompiler

    {-match "index.html" $ do
      route $ idRoute
      compile $ getResourceBody
        >>= relativizeUrls-}

    match "layouts/*" $ compile templateBodyCompiler

