From ec3a4a4715700294206d6e78d8b38a57a7de7592 Mon Sep 17 00:00:00 2001 From: Carlos Sosa Date: Sat, 24 Aug 2019 20:47:26 -0700 Subject: 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]] --- src/Site/Contexts.hs | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/Site/Contexts.hs (limited to 'src/Site/Contexts.hs') 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 -- cgit v1.3-2-g0d8e