summaryrefslogtreecommitdiff
path: root/src/Site/Contexts.hs
blob: f38344472b51eeef3bc893e3e30a26893f5f2a88 (plain)
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
module Site.Contexts
        ( indexCtx
        , archiveCtx
        , logArchiveCtx
        , gsocArchiveCtx
        , postCtx
        , postForArchiveCtx
        , gsocPostForArchiveCtx
        , dateForArchiveCtx
        )
where
import           Data.Monoid                    ( (<>) )
import           Site.Compilers
import           Hakyll                         ( Context
                                                , defaultContext
                                                , constField
                                                , dateField
                                                , listField
                                                )

indexCtx :: Context String
indexCtx =
        listField "articles" defaultContext recentArticles
                <> listField "rposts" defaultContext recentPosts
                <> constField "essays" "Soon"
                <> constField "title"  "Home"
                <> defaultContext

archiveCtx :: String -> Context String
archiveCtx title = constField "title" title <> defaultContext

logArchiveCtx :: Context String
logArchiveCtx = archiveCtx "archive of log posts"

gsocArchiveCtx :: Context String
gsocArchiveCtx = archiveCtx "archive of my GSoC reports."

postCtx :: Context String
postCtx = dateField "date" "%B %e, %Y" <> defaultContext

postForArchiveCtx :: Context String
postForArchiveCtx = listField "posts" dateForArchiveCtx posts <> defaultContext

gsocPostForArchiveCtx :: Context String
gsocPostForArchiveCtx =
        listField "posts" dateForArchiveCtx gsocPosts <> defaultContext

dateForArchiveCtx :: Context String
dateForArchiveCtx = dateField "date" "%d %b %Y" <> defaultContext