summaryrefslogtreecommitdiff
path: root/site.hs
diff options
context:
space:
mode:
authorjamie <git@skilet.ro>2025-06-15 19:31:21 +0100
committerjamie <git@skilet.ro>2025-06-15 19:31:21 +0100
commit3668aa96f18127cccb546b4138e98fbafa8b7dd8 (patch)
tree692f8b455584c386717635536cea9cc96445eea2 /site.hs
parentcce9351aae53fb09e5e510d3d5db8987b4fc5b62 (diff)
chore(hs): format site.hs
Diffstat (limited to '')
-rw-r--r--site.hs138
1 files changed, 71 insertions, 67 deletions
diff --git a/site.hs b/site.hs
index b116755..851d53d 100644
--- a/site.hs
+++ b/site.hs
@@ -1,91 +1,95 @@
--------------------------------------------------------------------------------
{-# LANGUAGE OverloadedStrings #-}
-import Data.Monoid (mappend)
-import Hakyll
+import Data.Monoid (mappend)
+import Hakyll
--------------------------------------------------------------------------------
main :: IO ()
main = hakyll $ do
- match "images/*" $ do
- route idRoute
- compile copyFileCompiler
+ match "images/*" $ do
+ route idRoute
+ compile copyFileCompiler
- match "css/*" $ do
- route idRoute
- compile compressCssCompiler
+ match "css/*.css" $ do
+ route idRoute
+ compile compressCssCompiler
- match (fromList ["about.rst", "contact.markdown"]) $ do
- route $ setExtension "html"
- compile $ pandocCompiler
- >>= loadAndApplyTemplate "templates/default.html" defaultContext
- >>= relativizeUrls
+ match (fromList ["about.rst", "contact.markdown"]) $ do
+ route $ setExtension "html"
+ compile $
+ pandocCompiler
+ >>= loadAndApplyTemplate "templates/default.html" defaultContext
+ >>= relativizeUrls
- match "posts/*" $ do
- route $ setExtension "html"
- compile $ pandocCompiler
- >>= loadAndApplyTemplate "templates/post.html" postCtx
- >>= saveSnapshot "content"
- >>= loadAndApplyTemplate "templates/default.html" postCtx
- >>= relativizeUrls
+ match "posts/*" $ do
+ route $ setExtension "html"
+ compile $
+ pandocCompiler
+ >>= loadAndApplyTemplate "templates/post.html" postCtx
+ >>= saveSnapshot "content"
+ >>= loadAndApplyTemplate "templates/default.html" postCtx
+ >>= relativizeUrls
- create ["archive.html"] $ do
- route idRoute
- compile $ do
- posts <- recentFirst =<< loadAll "posts/*"
- let archiveCtx =
- listField "posts" postCtx (return posts) `mappend`
- constField "title" "Archives" `mappend`
- defaultContext
+ create ["archive.html"] $ do
+ route idRoute
+ compile $ do
+ posts <- recentFirst =<< loadAll "posts/*"
+ let archiveCtx =
+ listField "posts" postCtx (return posts)
+ `mappend` constField "title" "Archives"
+ `mappend` defaultContext
- makeItem ""
- >>= loadAndApplyTemplate "templates/archive.html" archiveCtx
- >>= loadAndApplyTemplate "templates/default.html" archiveCtx
- >>= relativizeUrls
+ makeItem ""
+ >>= loadAndApplyTemplate "templates/archive.html" archiveCtx
+ >>= loadAndApplyTemplate "templates/default.html" archiveCtx
+ >>= relativizeUrls
- create ["atom.xml"] $ do
- route idRoute
- compile $ do
- let feedCtx = postCtx `mappend` bodyField "description"
- posts <- fmap (take 10) . recentFirst =<<
- loadAllSnapshots "posts/*" "content"
- renderAtom feedConfiguration feedCtx posts
+ create ["atom.xml"] $ do
+ route idRoute
+ compile $ do
+ let feedCtx = postCtx `mappend` bodyField "description"
+ posts <-
+ fmap (take 10) . recentFirst
+ =<< loadAllSnapshots "posts/*" "content"
+ renderAtom feedConfiguration feedCtx posts
- create ["rss.xml"] $ do
- route idRoute
- compile $ do
- let feedCtx = postCtx `mappend` bodyField "description"
- posts <- fmap (take 10) . recentFirst =<<
- loadAllSnapshots "posts/*" "content"
- renderRss feedConfiguration feedCtx posts
+ create ["rss.xml"] $ do
+ route idRoute
+ compile $ do
+ let feedCtx = postCtx `mappend` bodyField "description"
+ posts <-
+ fmap (take 10) . recentFirst
+ =<< loadAllSnapshots "posts/*" "content"
+ renderRss feedConfiguration feedCtx posts
- match "index.html" $ do
- route idRoute
- compile $ do
- posts <- recentFirst =<< loadAll "posts/*"
- let indexCtx =
- listField "posts" postCtx (return posts) `mappend`
- defaultContext
+ 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
+ getResourceBody
+ >>= applyAsTemplate indexCtx
+ >>= loadAndApplyTemplate "templates/default.html" indexCtx
+ >>= relativizeUrls
+ match "templates/*" $ compile templateBodyCompiler
--------------------------------------------------------------------------------
feedConfiguration :: FeedConfiguration
-feedConfiguration = FeedConfiguration
- { feedTitle = "Posts on Skiletro.com"
- , feedDescription = "Recent posts from Skiletro.com"
- , feedAuthorName = "Skiletro"
- , feedAuthorEmail = "19377854+skiletro@users.noreply.github.com" -- you're not getting my email that easily
- , feedRoot = "https://skiletro.com"
+feedConfiguration =
+ FeedConfiguration
+ { feedTitle = "Posts on Skiletro.com",
+ feedDescription = "Recent posts from Skiletro.com",
+ feedAuthorName = "Skiletro",
+ feedAuthorEmail = "19377854+skiletro@users.noreply.github.com", -- you're not getting my email that easily
+ feedRoot = "https://skiletro.com"
}
postCtx :: Context String
postCtx =
- dateField "date" "%B %e, %Y" `mappend`
- defaultContext
+ dateField "date" "%B %e, %Y"
+ `mappend` defaultContext