blob: e5f92b9ec4b8fde6d9acdff1a0b26ce97b9c91d9 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
{-# LANGUAGE OverloadedStrings #-}
import Data.List (sortBy)
import Data.Monoid (mappend)
import Data.Ord (comparing)
import Hakyll
import Hakyll.Core.Item (Item(itemIdentifier))
main :: IO ()
main = hakyllWith configuration $ do
match "images/*" $ do
route idRoute
compile copyFileCompiler
match "design/*.hs" $ do
route $ setExtension "css"
compile $ getResourceString >>= withItemBody (unixFilter "runghc" [])
match "recipes/*" $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/main.html" defaultContext
>>= relativizeUrls
match "index.html" $ do
route idRoute
let context =
listField "recipes" defaultContext (loadAll "recipes/*") `mappend`
defaultContext
compile $
getResourceBody
>>= applyAsTemplate context
>>= loadAndApplyTemplate "templates/main.html" context
>>= relativizeUrls
match "templates/*" $ compile templateBodyCompiler
configuration :: Configuration
configuration = defaultConfiguration
{ destinationDirectory = "public"
, inMemoryCache = True
}
|