@@ -25,7 +25,7 @@ main = hakyll $ do
25
25
match " index.html" $ do
26
26
route idRoute
27
27
compile $ do
28
- sponsors <- sponsorsCtx . sortOn itemIdentifier <$> loadAll " donations/sponsors/*.markdown "
28
+ sponsors <- buildSponsorsCtx
29
29
getResourceBody
30
30
>>= applyAsTemplate sponsors
31
31
>>= loadAndApplyTemplate " templates/boilerplate.html" sponsors
@@ -39,7 +39,7 @@ main = hakyll $ do
39
39
create [" affiliates/index.html" ] $ do
40
40
route idRoute
41
41
compile $ do
42
- sponsors <- sponsorsCtx . sortOn itemIdentifier <$> loadAll " donations/sponsors/*.markdown "
42
+ sponsors <- buildSponsorsCtx
43
43
ctx <- affiliatesCtx . sortOn itemIdentifier <$> loadAll " affiliates/*.markdown"
44
44
45
45
makeItem " "
@@ -52,7 +52,7 @@ main = hakyll $ do
52
52
create [" projects/index.html" ] $ do
53
53
route idRoute
54
54
compile $ do
55
- sponsors <- sponsorsCtx . sortOn itemIdentifier <$> loadAll " donations/sponsors/*.markdown "
55
+ sponsors <- buildSponsorsCtx
56
56
ctx <- projectsCtx . sortOn itemIdentifier <$> loadAll " projects/*.markdown"
57
57
58
58
makeItem " "
@@ -78,7 +78,7 @@ main = hakyll $ do
78
78
create [" news/index.html" ] $ do
79
79
route idRoute
80
80
compile $ do
81
- sponsors <- sponsorsCtx . sortOn itemIdentifier <$> loadAll " donations/sponsors/*.markdown "
81
+ sponsors <- buildSponsorsCtx
82
82
newsWithCategories <- recentFirst =<< loadAll " news/categories/**.html"
83
83
84
84
let ctx =
@@ -95,15 +95,15 @@ main = hakyll $ do
95
95
create [" news/press/index.html" ] $ do
96
96
route idRoute
97
97
compile $ do
98
- sponsors <- sponsorsCtx . sortOn itemIdentifier <$> loadAll " donations/sponsors/*.markdown "
98
+ sponsors <- buildSponsorsCtx
99
99
press <- recentFirst =<< loadAll " press/*.markdown"
100
100
101
101
let ctx =
102
102
listField " press_articles" defaultContext (return press) <>
103
103
defaultContext
104
104
105
105
makeItem " "
106
- >>= loadAndApplyTemplate " templates/press/list.html" ctx
106
+ >>= loadAndApplyTemplate " templates/press/list.html" ctx
107
107
>>= loadAndApplyTemplate " templates/boilerplate.html" sponsors
108
108
>>= relativizeUrls
109
109
@@ -112,7 +112,7 @@ main = hakyll $ do
112
112
create [" faq/index.html" ] $ do
113
113
route idRoute
114
114
compile $ do
115
- sponsors <- sponsorsCtx . sortOn itemIdentifier <$> loadAll " donations/sponsors/*.markdown "
115
+ sponsors <- buildSponsorsCtx
116
116
ctx <- faqCtx <$> loadAll " faq/*.markdown"
117
117
118
118
makeItem " "
@@ -125,12 +125,16 @@ main = hakyll $ do
125
125
create [" resources/index.html" ] $ do
126
126
route idRoute
127
127
compile $ do
128
- sponsors <- sponsorsCtx . sortOn itemIdentifier <$> loadAll " donations/sponsors/*.markdown"
129
- ctx <- resourcesCtx <$> loadAll " resources/*.markdown"
128
+ sponsors <- buildSponsorsCtx
129
+ resources <- loadAll " resources/*.markdown"
130
+
131
+ let ctx =
132
+ listField " resources" defaultContext (return resources) <>
133
+ defaultContext
130
134
131
135
makeItem " "
132
- >>= loadAndApplyTemplate " templates/resources/list.html" ctx
133
- >>= loadAndApplyTemplate " templates/boilerplate.html" sponsors
136
+ >>= loadAndApplyTemplate " templates/resources/list.html" ctx
137
+ >>= loadAndApplyTemplate " templates/boilerplate.html" sponsors
134
138
>>= relativizeUrls
135
139
136
140
-- templates -------------------------------------------------------------------------------------------
@@ -143,6 +147,10 @@ main = hakyll $ do
143
147
--------------------------------------------------------------------------------------------------------
144
148
145
149
-- sponsors --------------------------------------------------------------------------------------------
150
+
151
+ buildSponsorsCtx :: Compiler (Context String )
152
+ buildSponsorsCtx = sponsorsCtx . sortOn itemIdentifier <$> loadAll " donations/sponsors/*.markdown"
153
+
146
154
-- | Partition sponsors into by level: monad, applicative, and functor
147
155
-- Sponsors are listed in the footer template, which means we need this
148
156
-- context for most pages.
@@ -203,12 +211,6 @@ faqCtx entries =
203
211
listField " faq_entries" defaultContext (sortFromMetadataField " order" entries) <>
204
212
defaultContext
205
213
206
- -- resources -------------------------------------------------------------------------------------------
207
- resourcesCtx :: [Item String ] -> Context String
208
- resourcesCtx resources =
209
- listField " resources" defaultContext (return resources) <>
210
- defaultContext
211
-
212
214
--------------------------------------------------------------------------------------------------------
213
215
-- UTILS -----------------------------------------------------------------------------------------------
214
216
--------------------------------------------------------------------------------------------------------
0 commit comments