@@ -9,6 +9,11 @@ import Data.Ord (comparing)
9
9
10
10
main :: IO ()
11
11
main = hakyll $ do
12
+
13
+ --------------------------------------------------------------------------------------------------------
14
+ -- STATICS ---------------------------------------------------------------------------------------------
15
+ --------------------------------------------------------------------------------------------------------
16
+
12
17
match " assets/css/main.css" $ do
13
18
route idRoute
14
19
compile compressCssCompiler
@@ -17,6 +22,10 @@ main = hakyll $ do
17
22
route idRoute
18
23
compile copyFileCompiler
19
24
25
+ --------------------------------------------------------------------------------------------------------
26
+ -- HOME ------------------------------------------------------------------------------------------------
27
+ --------------------------------------------------------------------------------------------------------
28
+
20
29
match " index.html" $ do
21
30
route idRoute
22
31
compile $ do
@@ -26,30 +35,36 @@ main = hakyll $ do
26
35
>>= loadAndApplyTemplate " templates/boilerplate.html" sponsors
27
36
>>= relativizeUrls
28
37
29
- match " affiliates/*.markdown" $ compile pandocCompiler
30
-
31
38
match " donations/sponsors/*.markdown" $ compile pandocCompiler
32
-
33
- match " affiliates/index.html" $ do
39
+ match " **/index.html" $ do
34
40
route idRoute
35
41
compile $ do
36
- affils <- affiliatesCtx . sortOn itemIdentifier <$> loadAll " affiliates/*.markdown"
37
- sponsors <- sponsorsCtx affils . sortOn itemIdentifier <$> loadAll " donations/sponsors/*.markdown"
38
-
42
+ sponsors <- sponsorsCtx defaultContext . sortOn itemIdentifier <$> loadAll " donations/sponsors/*.markdown"
39
43
getResourceBody
40
44
>>= applyAsTemplate sponsors
41
45
>>= loadAndApplyTemplate " templates/boilerplate.html" sponsors
42
46
>>= relativizeUrls
43
47
44
- match " **/index.html" $ do
48
+ --------------------------------------------------------------------------------------------------------
49
+ -- AFFILIATES ------------------------------------------------------------------------------------------
50
+ --------------------------------------------------------------------------------------------------------
51
+
52
+ match " affiliates/*.markdown" $ compile pandocCompiler
53
+ match " affiliates/index.html" $ do
45
54
route idRoute
46
55
compile $ do
47
- sponsors <- sponsorsCtx defaultContext . sortOn itemIdentifier <$> loadAll " donations/sponsors/*.markdown"
56
+ affils <- affiliatesCtx . sortOn itemIdentifier <$> loadAll " affiliates/*.markdown"
57
+ sponsors <- sponsorsCtx affils . sortOn itemIdentifier <$> loadAll " donations/sponsors/*.markdown"
58
+
48
59
getResourceBody
49
60
>>= applyAsTemplate sponsors
50
61
>>= loadAndApplyTemplate " templates/boilerplate.html" sponsors
51
62
>>= relativizeUrls
52
63
64
+ --------------------------------------------------------------------------------------------------------
65
+ -- PROJECTS --------------------------------------------------------------------------------------------
66
+ --------------------------------------------------------------------------------------------------------
67
+
53
68
match " projects/*.markdown" $ compile pandocCompiler
54
69
55
70
create [" projects/index.html" ] $ do
@@ -66,6 +81,10 @@ main = hakyll $ do
66
81
match " news/**.markdown" $ compile pandocCompiler
67
82
categories <- buildCategories " news/**.markdown" (fromCapture " news/categories/**.html" )
68
83
84
+ --------------------------------------------------------------------------------------------------------
85
+ -- NEWS ------------------------------------------------------------------------------------------------
86
+ --------------------------------------------------------------------------------------------------------
87
+
69
88
tagsRules categories $ \ category catId -> compile $ do
70
89
news <- recentFirst =<< loadAll catId
71
90
let ctx =
@@ -91,9 +110,20 @@ main = hakyll $ do
91
110
>>= loadAndApplyTemplate " templates/boilerplate.html" sponsors
92
111
>>= relativizeUrls
93
112
113
+ --------------------------------------------------------------------------------------------------------
114
+ -- TEMPLATES -------------------------------------------------------------------------------------------
115
+ --------------------------------------------------------------------------------------------------------
116
+
94
117
match " templates/*" $ compile templateBodyCompiler
95
118
match " templates/**" $ compile templateBodyCompiler
96
119
120
+ --------------------------------------------------------------------------------------------------------
121
+ --------------------------------------------------------------------------------------------------------
122
+
123
+ --------------------------------------------------------------------------------------------------------
124
+ -- CONTEXT ---------------------------------------------------------------------------------------------
125
+ --------------------------------------------------------------------------------------------------------
126
+
97
127
-- | Partition affiliates into affiliates and pending
98
128
affiliatesCtx :: [Item String ] -> Context String
99
129
affiliatesCtx tuts =
@@ -152,6 +182,10 @@ newsWithCategoriesCtx categories =
152
182
newsCtx :: Context String
153
183
newsCtx = newsWithCategoriesCtx categories
154
184
185
+ --------------------------------------------------------------------------------------------------------
186
+ -- UTILS -----------------------------------------------------------------------------------------------
187
+ --------------------------------------------------------------------------------------------------------
188
+
155
189
-- | filter list of item string based on the given value to match on the given metadata field
156
190
ofMetadataField :: String -> String -> [Item String ] -> Compiler [Item String ]
157
191
ofMetadataField field value = filterM (\ item -> do
0 commit comments