blob: c4f339c207d5c37636eb22af273bbd6e2fc27727 (
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
44
45
46
47
48
49
50
|
{-# LANGUAGE OverloadedStrings #-}
import Hakyll
import Control.Monad (forM_)
import Control.Arrow ((>>>), arr)
import Text.Pandoc
main :: IO ()
main = hakyll $ do
route "css/*" idRoute
compile "css/*" compressCssCompiler
-- Static directories
forM_ ["images/*", "examples/*", "reference/*"] $ \f -> do
route f idRoute
compile f copyFileCompiler
-- Pages
forM_ pages $ \p -> do
route p $ setExtension "html"
compile p $ pageCompiler
>>> requireA "sidebar.markdown" (setFieldA "sidebar" $ arr pageBody)
>>> applyTemplateCompiler "templates/default.html"
>>> relativizeUrlsCompiler
-- Tutorial
route "tutorial.markdown" $ setExtension "html"
compile "tutorial.markdown" $ readPageCompiler
>>> pageRenderPandocWith defaultHakyllParserState withToc
>>> requireA "sidebar.markdown" (setFieldA "sidebar" $ arr pageBody)
>>> applyTemplateCompiler "templates/default.html"
>>> relativizeUrlsCompiler
-- Sidebar
compile "sidebar.markdown" pageCompiler
-- Templates
compile "templates/*" templateCompiler
where
withToc = defaultHakyllWriterOptions
{ writerTableOfContents = True
, writerTemplate = "<h2>Table of contents</h2>\n$toc$\n$body$"
, writerStandalone = True
}
pages = [ "about.markdown"
, "changelog.markdown"
, "index.markdown"
, "philosophy.markdown"
, "reference.markdown"
]
|