summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--site.hs37
1 files changed, 23 insertions, 14 deletions
diff --git a/site.hs b/site.hs
index 1913d6f..3148518 100644
--- a/site.hs
+++ b/site.hs
@@ -15,12 +15,6 @@ main = hakyll $ do
route idRoute
compile compressCssCompiler
- match (fromList ["about.rst", "contact.markdown"]) $ do
- route $ setExtension "html"
- compile $ pandocCompiler
- >>= loadAndApplyTemplate "templates/default.html" defaultContext
- >>= relativizeUrls
-
match "log/*.org" $ do
route $ setExtension "html"
compile $ pandocCompiler
@@ -35,12 +29,15 @@ main = hakyll $ do
>>= loadAndApplyTemplate "templates/post.html" archiveCtx
>>= relativizeUrls
+ match "article/**" $ do
+ route idRoute
+ compile getResourceBody
+
match "index.html" $ do
route idRoute
compile $ do
getResourceBody
>>= applyAsTemplate indexCtx
- >>= loadAndApplyTemplate "templates/default.html" indexCtx
>>= relativizeUrls
match "templates/*" $ compile templateBodyCompiler
@@ -50,16 +47,27 @@ main = hakyll $ do
posts :: Compiler [Item String]
posts = recentFirst =<< loadAll "log/*.org"
+articles :: Compiler [Item String]
+articles = loadAll "article/**"
+
+recentPosts :: Compiler [Item String]
+recentPosts = (take 4) <$> posts
+
+recentArticles :: Compiler [Item String]
+recentArticles = (take 4) <$> articles
+
indexCtx :: Context String
indexCtx =
- listField "posts" postCtx posts <>
- constField "title" "Home" <>
- defaultContext
+ listField "articles" defaultContext recentArticles
+ <> listField "rposts" defaultContext recentPosts
+ <> constField "essays" "Soon"
+ <> constField "title" "Home"
+ <> defaultContext
archiveCtx :: Context String
archiveCtx =
- constField "title" "archive of log posts" <>
- defaultContext
+ constField "title" "archive of log posts"
+ <> defaultContext
postCtx :: Context String
postCtx =
@@ -67,9 +75,10 @@ postCtx =
postForArchiveCtx :: Context String
postForArchiveCtx =
- listField "posts" dateForArchiveCtx posts <>
- defaultContext
+ listField "posts" dateForArchiveCtx posts
+ <> defaultContext
dateForArchiveCtx :: Context String
dateForArchiveCtx =
dateField "date" "%d %b %Y" <> defaultContext
+