summaryrefslogtreecommitdiff
path: root/site.hs
diff options
context:
space:
mode:
authorCarlos Sosa <gnusosa@gnusosa.net>2019-08-15 23:13:43 -0700
committerCarlos Sosa <gnusosa@gnusosa.net>2019-08-15 23:13:43 -0700
commit3fd226a458f77451fd97daf2b67f94747d07cb5a (patch)
tree0f5be395b7044e2cb39317e4e248c7efd5dcbc02 /site.hs
parenta2dc4200acf469a05f9f028439ffdb2c6180d3d9 (diff)
Add GSoC posts archive matchers and functions
Diffstat (limited to 'site.hs')
-rw-r--r--site.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/site.hs b/site.hs
index 6cd7c52..793810a 100644
--- a/site.hs
+++ b/site.hs
@@ -35,6 +35,14 @@ main = hakyll $ do
>>= loadAndApplyTemplate "templates/post.html" postCtx
>>= relativizeUrls
+ create ["gsoc/index.html"] $ do
+ route idRoute
+ compile $ do
+ makeItem ""
+ >>= loadAndApplyTemplate "templates/archive.html" gsocPostForArchiveCtx
+ >>= loadAndApplyTemplate "templates/post.html" gsocArchiveCtx
+ >>= relativizeUrls
+
match "article/**" $ do
route idRoute
compile getResourceBody
@@ -50,6 +58,9 @@ main = hakyll $ do
--------------------------------------------------------------------------------
+gsocPosts :: Compiler [Item String]
+gsocPosts = recentFirst =<< loadAll "gsoc/*.org"
+
posts :: Compiler [Item String]
posts = recentFirst =<< loadAll "log/*.org"
@@ -75,6 +86,11 @@ archiveCtx =
constField "title" "archive of log posts"
<> defaultContext
+gsocArchiveCtx :: Context String
+gsocArchiveCtx =
+ constField "title" "archive of my GSoC reports."
+ <> defaultContext
+
postCtx :: Context String
postCtx =
dateField "date" "%B %e, %Y" <> defaultContext
@@ -84,6 +100,11 @@ 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