forked from project-diamond/project-diamond.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.hs
81 lines (63 loc) · 2.27 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{-# LANGUAGE OverloadedStrings #-}
import Data.Monoid ( mappend, (<>))
import System.FilePath
import Hakyll
import Website.Utils
import Website.News
config :: Configuration
config = defaultConfiguration { deployCommand = "./scripts/deploy.sh" }
--------------------------------------------------------------------------------
main :: IO ()
main = hakyllWith config $ do
match "templates/**" $ compile templateCompiler
match "logo/*.png" $ do
route idRoute
compile copyFileCompiler
match "logo/*.ico" $ do
route idRoute
compile copyFileCompiler
match "images/*" $ do
route idRoute
compile copyFileCompiler
match "css/*" $ do
route idRoute
compile compressCssCompiler
match (fromList ["about.rst", "contact.markdown"]) $ do
route cleanRoute
compile stdCompiler
newsRules
match "index.html" $ do
route idRoute
let cxt = constField "title" "" <> allNewsField <> defaultContext
in compile $ getResourceBody
>>= applyAsTemplate cxt
>>= postProcessTemplates cxt ["templates/wrapper.html"]
{-
match "archive/index.md" $ do
route $ setExtension "html"
compile $ do
posts <- recentFirst =<< loadAll "posts/*"
let archiveCtx =
listField "posts" postCtx (return posts) `mappend`
constField "title" "Archives" `mappend`
defaultContext
getResourceBody
>>= applyAsTemplate archiveCtx
>>= renderPandoc
>>= loadAndApplyTemplate "templates/default.html" archiveCtx
>>= fixUrls
match "index.md" $ do
route $ setExtension ".html"
compile $ do
posts <- recentFirst =<< loadAll "posts/*"
let indexCtx =
listField "posts" postCtx (return posts)
<> constField "title" ""
<> defaultContext
getResourceBody
>>= applyAsTemplate indexCtx
>>= renderPandoc
>>= loadAndApplyTemplate "templates/default.html" indexCtx
>>= fixUrls
-}
--------------------------------------------------------------------------------