rauhala.info/site/app/site.hs

45 lines
1.0 KiB
Haskell
Raw Normal View History

2018-09-20 20:58:27 +03:00
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
2021-01-25 19:29:45 +02:00
import Hakyll
import Data.List
(isSuffixOf)
2018-09-20 20:58:27 +03:00
--------------------------------------------------------------------------------
main :: IO ()
2020-02-01 22:25:52 +02:00
main = hakyllWith defaultConfiguration $ do
2021-01-25 19:29:45 +02:00
match "well-known/*" $ do
route (customRoute (prepend '.'. toFilePath))
compile copyFileCompiler
2020-02-01 22:25:52 +02:00
2021-01-25 19:29:45 +02:00
match "images/*" $ do
route idRoute
compile copyFileCompiler
2018-09-20 20:58:27 +03:00
2021-01-25 19:29:45 +02:00
match "resources/*" $ do
route idRoute
compile copyFileCompiler
2018-09-20 20:58:27 +03:00
2021-01-25 19:29:45 +02:00
match "css/*" $ do
route idRoute
compile compressCssCompiler
2018-09-20 20:58:27 +03:00
2021-01-25 19:29:45 +02:00
match "js/*" $ do
route idRoute
compile compressCssCompiler
2018-09-20 22:23:57 +03:00
2021-01-25 19:29:45 +02:00
match (fromList ["index.markdown", "contact.markdown"]) $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
2018-09-20 20:58:27 +03:00
2021-01-25 19:29:45 +02:00
match "templates/*" $ compile templateBodyCompiler
2018-09-20 20:58:27 +03:00
2020-02-01 22:25:52 +02:00
prepend :: a -> [a] -> [a]
prepend = (:)