Skip to content

Commit 2850392

Browse files
committed
feat: generate resources page from data
1 parent 5da590c commit 2850392

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

site.hs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,19 @@ main = hakyll $ do
120120
>>= loadAndApplyTemplate "templates/boilerplate.html" sponsors
121121
>>= relativizeUrls
122122

123+
-- resources -------------------------------------------------------------------------------------------
124+
match "resources/*.markdown" $ compile pandocCompiler
125+
create ["resources/index.html"] $ do
126+
route idRoute
127+
compile $ do
128+
sponsors <- sponsorsCtx . sortOn itemIdentifier <$> loadAll "donations/sponsors/*.markdown"
129+
ctx <- resourcesCtx . sortOn itemIdentifier <$> loadAll "resources/*.markdown"
130+
131+
makeItem ""
132+
>>= loadAndApplyTemplate "templates/resources/list.html" ctx
133+
>>= loadAndApplyTemplate "templates/boilerplate.html" sponsors
134+
>>= relativizeUrls
135+
123136
-- templates -------------------------------------------------------------------------------------------
124137
match "templates/*" $ compile templateBodyCompiler
125138
match "templates/**" $ compile templateBodyCompiler
@@ -190,6 +203,12 @@ faqCtx entries =
190203
listField "faq_entries" defaultContext (sortFromMetadataField "order" entries) <>
191204
defaultContext
192205

206+
-- resources -------------------------------------------------------------------------------------------
207+
resourcesCtx :: [Item String] -> Context String
208+
resourcesCtx resources =
209+
listField "resources" defaultContext (return resources) <>
210+
defaultContext
211+
193212
--------------------------------------------------------------------------------------------------------
194213
-- UTILS -----------------------------------------------------------------------------------------------
195214
--------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)