Skip to content

Commit 015f89e

Browse files
authored
Merge pull request #126 from Maeevick/feat/hakyll-faq-page-migration
feat: generated faq page
2 parents 0cb8e6e + c37302a commit 015f89e

9 files changed

+102
-88
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: How Do Projects Or Teams Affiliate With The Haskell Foundation?
3+
order: 0
4+
---
5+
Organizations and committees can review the <a href='https://docs.google.com/document/d/1sL0Nw3VEvxLT39WOkKhtR2_sOUctwVSZ_A4GDZV_mvU/edit' target='_blank'>Haskell Foundation Affiliation Documents</a> to learn more about how you can become affiliated with the Haskell Foundation. Please email <a href='mailto:[email protected]'>[email protected]</a> for more information.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: What Is The Relationship Between HF And Haskell.Org?
3+
order: 3
4+
---
5+
The Haskell.org committee has voted to affiliate with the Haskell Foundation, however the haskell.org committee remains an independent 501-3 (c) nonprofit organization. The haskell.org committee will continue to operate the haskell.org website and provide resources for Haskell infrastructure such as Hackage and the haskell mailing lists. Several members of haskell.org have helped launch HF.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: What Is The Relationship Between HF And The Community, Industry, Etc.
3+
order: 1
4+
---
5+
The goal of the Haskell Foundation is to facilitate a dialogue for improvement, and center the Haskell community and its industry in one place. Previously, there were many disparate groups consisting of volunteers and members of industry working together to improve the state of Haskell. However, some things in the ecosystem are complicated, and require organization and funding to move forward. The Haskell Foundation addresses that need, and provides a central locus and flag for these groups to rally around to coordinate work, funding, and direction.

faq/who-is-involved.markdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: Who’s Involved?
3+
order: 2
4+
---
5+
The Haskell Foundation was founded by members of the Haskell community, with help and input from existing Haskell users, committees, and industrial users. Our sponsors page includes information about the organizations who have generously provided support for the Haskell Foundation.

haskell-foundation.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ executable site
77
main-is: site.hs
88
build-depends: base == 4.*
99
, hakyll
10+
, monadlist
1011
ghc-options: -threaded
1112
default-language: Haskell2010

site.hs

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
{-# Language ViewPatterns #-}
44

55
import Hakyll
6-
import Control.Monad (filterM)
76
import Data.List (sortOn)
8-
import Data.Ord (comparing)
7+
import Control.Monad (filterM)
8+
import Control.Monad.ListM (sortByM)
99

1010
--------------------------------------------------------------------------------------------------------
1111
-- MAIN GENERATION -------------------------------------------------------------------------------------
@@ -80,7 +80,7 @@ main = hakyll $ do
8080
compile $ do
8181
sponsors <- sponsorsCtx . sortOn itemIdentifier <$> loadAll "donations/sponsors/*.markdown"
8282
newsWithCategories <- recentFirst =<< loadAll "news/categories/**.html"
83-
83+
8484
let ctx =
8585
listField "categories" defaultContext (return newsWithCategories) <>
8686
defaultContext
@@ -107,6 +107,19 @@ main = hakyll $ do
107107
>>= loadAndApplyTemplate "templates/boilerplate.html" sponsors
108108
>>= relativizeUrls
109109

110+
-- faq ------------------------------------------------------------------------------------------------
111+
match "faq/*.markdown" $ compile pandocCompiler
112+
create ["faq/index.html"] $ do
113+
route idRoute
114+
compile $ do
115+
sponsors <- sponsorsCtx . sortOn itemIdentifier <$> loadAll "donations/sponsors/*.markdown"
116+
ctx <- faqCtx <$> loadAll "faq/*.markdown"
117+
118+
makeItem ""
119+
>>= loadAndApplyTemplate "templates/faq/list.html" ctx
120+
>>= loadAndApplyTemplate "templates/boilerplate.html" sponsors
121+
>>= relativizeUrls
122+
110123
-- templates -------------------------------------------------------------------------------------------
111124
match "templates/*" $ compile templateBodyCompiler
112125
match "templates/**" $ compile templateBodyCompiler
@@ -171,6 +184,11 @@ newsWithCategoriesCtx categories =
171184
newsCtx :: Context String
172185
newsCtx = newsWithCategoriesCtx categories
173186

187+
-- faq -------------------------------------------------------------------------------------------------
188+
faqCtx :: [Item String] -> Context String
189+
faqCtx entries =
190+
listField "faq_entries" defaultContext (sortFromMetadataField "order" entries) <>
191+
defaultContext
174192

175193
--------------------------------------------------------------------------------------------------------
176194
-- UTILS -----------------------------------------------------------------------------------------------
@@ -182,3 +200,11 @@ ofMetadataField field value = filterM (\item -> do
182200
mbStatus <- getMetadataField (itemIdentifier item) field
183201
return $ Just value == mbStatus
184202
)
203+
204+
-- | sort list of item based on the given metadata field
205+
sortFromMetadataField :: String -> [Item String] -> Compiler [Item String]
206+
sortFromMetadataField field = sortByM (\a b -> do
207+
a' <- getMetadataField (itemIdentifier a) field
208+
b' <- getMetadataField (itemIdentifier b) field
209+
return $ compare a' b'
210+
)

site/faq/index.html

Lines changed: 0 additions & 85 deletions
This file was deleted.

templates/faq/list.html

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<div class="max-w-screen-xl mx-auto py-16 md:py-24">
2+
<div class="sm:px-6 lg:px-16">
3+
<div class="relative">
4+
<div class="absolute top-0 left-0 border-t border-l border-purple-50 h-10 md:h-20 w-10 md:w-20">
5+
<div
6+
class="absolute top-1 md:top-2 left-1 md:left-2 border-t border-l border-purple-100 h-10 md:h-20 w-10 md:w-20">
7+
<div
8+
class="absolute top-1 md:top-2 left-1 md:left-2 border-t border-l border-purple-200 h-10 md:h-20 w-10 md:w-20">
9+
<div
10+
class="absolute top-1 md:top-2 left-1 md:left-2 border-t border-l border-purple-300 h-10 md:h-20 w-10 md:w-20">
11+
<div
12+
class="absolute top-1 md:top-2 left-1 md:left-2 border-t border-l border-purple-400 h-10 md:h-20 w-10 md:w-20">
13+
<div
14+
class="absolute top-1 md:top-2 left-1 md:left-2 border-t border-l border-purple-500 h-10 md:h-20 w-10 md:w-20">
15+
</div>
16+
</div>
17+
</div>
18+
</div>
19+
</div>
20+
</div>
21+
<div class="absolute top-0 right-0 border-t border-r border-purple-50 h-10 md:h-20 w-10 md:w-20">
22+
<div
23+
class="absolute top-1 md:top-2 right-1 md:right-2 border-t border-r border-purple-100 h-10 md:h-20 w-10 md:w-20">
24+
<div
25+
class="absolute top-1 md:top-2 right-1 md:right-2 border-t border-r border-purple-200 h-10 md:h-20 w-10 md:w-20">
26+
<div
27+
class="absolute top-1 md:top-2 right-1 md:right-2 border-t border-r border-purple-300 h-10 md:h-20 w-10 md:w-20">
28+
<div
29+
class="absolute top-1 md:top-2 right-1 md:right-2 border-t border-r border-purple-400 h-10 md:h-20 w-10 md:w-20">
30+
<div
31+
class="absolute top-1 md:top-2 right-1 md:right-2 border-t border-r border-purple-500 h-10 md:h-20 w-10 md:w-20">
32+
</div>
33+
</div>
34+
</div>
35+
</div>
36+
</div>
37+
</div>
38+
</div>
39+
</div>
40+
<div class="text-center pt-12 md:pt-20 px-12 sm:px-16 md:px-24 lg:px-36 ">
41+
<h1 class="text-2xl-5xl">FAQ</h1>
42+
</div>
43+
</div>
44+
<div class="max-w-screen-md mx-auto grid gap-8">
45+
$for(faq_entries)$
46+
$partial("templates/faq/tile.html")$
47+
$endfor$
48+
</div>

templates/faq/tile.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div class="bg-gray-100 px-6 sm:px-12 space-y-4 py-12">
2+
<h2 class="font-normal text-xl-2xl">$title$</h2>
3+
$body$
4+
</div>

0 commit comments

Comments
 (0)