summaryrefslogtreecommitdiff
path: root/examples/morepages/hakyll.hs
blob: d62f8a884d5e8e68fe12cef961503317e8f5566e (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
{-# LANGUAGE OverloadedStrings, Arrows #-}
module Main where

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

import Hakyll

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

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

    -- Compile footer
    compile "footer.markdown" pageCompiler

    -- Read templates
    compile "templates/*" templateCompiler