diff options
author | cel 🌸 <cel@blos.sm> | 2024-05-07 05:21:25 +0100 |
---|---|---|
committer | cel 🌸 <cel@blos.sm> | 2024-05-07 05:21:25 +0100 |
commit | baacd0288136b41507479bc40c29f4f69e1f688a (patch) | |
tree | 38f9023bbd118f11a9211aab656c859ae2904ce2 /site.hs | |
download | bunblog-baacd0288136b41507479bc40c29f4f69e1f688a.tar.gz bunblog-baacd0288136b41507479bc40c29f4f69e1f688a.tar.bz2 bunblog-baacd0288136b41507479bc40c29f4f69e1f688a.zip |
initial commit
Diffstat (limited to '')
-rw-r--r-- | site.hs | 67 |
1 files changed, 67 insertions, 0 deletions
@@ -0,0 +1,67 @@ +-------------------------------------------------------------------------------- +{-# LANGUAGE OverloadedStrings #-} +import Data.Monoid (mappend) +import Hakyll + + +-------------------------------------------------------------------------------- +main :: IO () +main = hakyll $ do + create ["feed.xml"] $ do + route idRoute + compile $ do + let feedCtx = postCtx `mappend` bodyField "description" + posts <- fmap (take 10) . recentFirst =<< loadAllSnapshots "posts/*" "content" + renderAtom feedConfig feedCtx posts + + match "images/*" $ do + route idRoute + compile copyFileCompiler + + match "fonts/*" $ do + route idRoute + compile copyFileCompiler + + match "style.css" $ do + route idRoute + compile compressCssCompiler + + match "posts/*" $ do + route $ setExtension "html" + compile $ pandocCompiler + >>= loadAndApplyTemplate "templates/post.html" postCtx + >>= saveSnapshot "content" + >>= loadAndApplyTemplate "templates/default.html" postCtx + >>= relativizeUrls + + + match "index.html" $ do + route idRoute + compile $ do + posts <- recentFirst =<< loadAll "posts/*" + let indexCtx = + listField "posts" postCtx (return posts) `mappend` + defaultContext + + getResourceBody + >>= applyAsTemplate indexCtx + >>= loadAndApplyTemplate "templates/default.html" indexCtx + >>= relativizeUrls + + match "templates/*" $ compile templateBodyCompiler + + +-------------------------------------------------------------------------------- +postCtx :: Context String +postCtx = + dateField "date" "%Y-%m-%d" `mappend` + defaultContext + +feedConfig :: FeedConfiguration +feedConfig = FeedConfiguration + { feedTitle = "cel's dev?blog" + , feedDescription = "banished technology" + , feedAuthorName = "cel ❀" + , feedAuthorEmail = "cel@bunny.garden" + , feedRoot = "https://bunny.garden/~cel" + } |