forked from nixcon/2019.nixcon.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
site.hs
executable file
·78 lines (62 loc) · 2.16 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
#!/usr/bin/env nix-shell
#!nix-shell -i "runhaskell -Wall -no-user-package-db"
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
import Data.Monoid (mappend)
import Hakyll
import Hakyll.Images ( loadImage
, compressJpgCompiler
, scaleImageCompiler
)
--------------------------------------------------------------------------------
main :: IO ()
main = hakyll $ do
match "favicon.png" $ do
route idRoute
compile copyFileCompiler
match "materialize/**/*" $ do
route idRoute
compile copyFileCompiler
match "images/**" $ do
route idRoute
compile copyFileCompiler
match "pictures/**" $ do
route idRoute
compile $ loadImage
>>= scaleImageCompiler 1200 450
>>= compressJpgCompiler 90
match "googlead1fe7ef91f639f7.html" $ do
route idRoute
compile copyFileCompiler
match "*.json" $ do
route idRoute
compile copyFileCompiler
match "participants/**/*" $ do
route idRoute
compile copyFileCompiler
match "js/*" $ do
route idRoute
compile copyFileCompiler
match "fonts/**/*" $ do
route idRoute
compile copyFileCompiler
match "css/*" $ do
route idRoute
compile compressCssCompiler
match (fromList ["code-of-conduct.md"]) $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/container.html" defaultContext
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
match "*.html" $ do
route idRoute
compile $ getResourceBody
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
match "templates/*" $ compile templateBodyCompiler
--------------------------------------------------------------------------------
postCtx :: Context String
postCtx =
dateField "date" "%B %e, %Y" `mappend`
defaultContext