summaryrefslogtreecommitdiff
path: root/examples/morepages/hakyll.hs
blob: c1b96e6752f14710e5c473668140e06c2a2e49d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{-# LANGUAGE OverloadedStrings, Arrows #-}
module Main where

import Control.Monad (forM_)
import Control.Arrow (arr, (>>>))

import Hakyll

main :: IO ()
main = hakyll $ do
    -- Compress CSS
    match "css/*" $ do
        route   idRoute
        compile compressCssCompiler

    -- Render static pages
    forM_ ["about.markdown", "index.markdown", "products.markdown"] $ \p ->
        match p $ do
            route   $ setExtension ".html"
            compile $ pageCompiler
                >>> requireA "footer.markdown" (setFieldA "footer" $ arr pageBody)
                >>> applyTemplateCompiler "templates/default.html"
                >>> relativizeUrlsCompiler

    -- Compile footer
    match "footer.markdown" $ compile pageCompiler

    -- Read templates
    match "templates/*" $ compile templateCompiler