summaryrefslogtreecommitdiff
path: root/src/Site/Contexts.hs
diff options
context:
space:
mode:
authorCarlos Sosa <gnusosa@gnusosa.net>2019-08-24 20:47:26 -0700
committerCarlos Sosa <gnusosa@gnusosa.net>2019-08-24 20:47:26 -0700
commitec3a4a4715700294206d6e78d8b38a57a7de7592 (patch)
tree82f7bf9cd081332216efb7f4e2eed77240f2c845 /src/Site/Contexts.hs
parent03a8fc8f75a1bf0f5afb7d0dd11cd7e881a7d763 (diff)
Move to use src/ directory with the addition of Site modules
- Added Content record with Lenses. - Added Rules based content compilers * This is all based on [[https://github.com/blaenk/blaenk.github.io/blob/source/src/Site/Compilers.hs]]
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