summaryrefslogtreecommitdiff
path: root/src/Site/Contexts.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Site/Contexts.hs')
-rw-r--r--src/Site/Contexts.hs49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/Site/Contexts.hs b/src/Site/Contexts.hs
new file mode 100644
index 0000000..f383444
--- /dev/null
+++ b/src/Site/Contexts.hs
@@ -0,0 +1,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