-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsite.hs
56 lines (52 loc) · 1.26 KB
/
site.hs
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
44
45
46
47
48
49
50
51
52
53
54
55
56
{-# LANGUAGE OverloadedStrings #-}
import Hakyll
( Configuration (destinationDirectory),
compile,
constRoute,
copyFileCompiler,
defaultConfiguration,
defaultContext,
defaultHakyllReaderOptions,
defaultHakyllWriterOptions,
hakyllWith,
idRoute,
loadAndApplyTemplate,
match,
pandocCompilerWith,
relativizeUrls,
route,
templateBodyCompiler,
)
import Text.Pandoc.Extensions
( Extension (Ext_fenced_divs),
enableExtension,
)
import Text.Pandoc.Options
( ReaderOptions,
readerExtensions,
)
config :: Configuration
config =
defaultConfiguration
{ destinationDirectory = "generated"
}
main :: IO ()
main = hakyllWith config $ do
match "content/index.md" $ do
route $ constRoute "index.html"
compile $
pandocCompilerWith readerOptions defaultHakyllWriterOptions
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
match "css/*" $ do
route idRoute
compile copyFileCompiler
match "templates/*" $ do
compile templateBodyCompiler
readerOptions :: ReaderOptions
readerOptions =
defaultHakyllReaderOptions
{ readerExtensions =
enableExtension Ext_fenced_divs $
readerExtensions defaultHakyllReaderOptions
}