summaryrefslogtreecommitdiff
path: root/site.hs
diff options
context:
space:
mode:
authorjamie <git@skilet.ro>2025-05-28 17:43:48 +0100
committerjamie <git@skilet.ro>2025-06-15 19:04:05 +0100
commitbbb5ceddf960681050e3d942c2f0d7fc27482d13 (patch)
tree88b105effc5ca2ac204bc064244e2bbd9b1154c4 /site.hs
parent5f78c00c62a9dae5c0901a1f824f8df1a282c755 (diff)
feat: add basic rss feed
Diffstat (limited to '')
-rw-r--r--site.hs25
1 files changed, 25 insertions, 0 deletions
diff --git a/site.hs b/site.hs
index f370ed9..b116755 100644
--- a/site.hs
+++ b/site.hs
@@ -25,6 +25,7 @@ main = hakyll $ do
route $ setExtension "html"
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/post.html" postCtx
+ >>= saveSnapshot "content"
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
@@ -42,6 +43,21 @@ main = hakyll $ do
>>= 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 ["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
@@ -60,6 +76,15 @@ main = hakyll $ do
--------------------------------------------------------------------------------
+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"
+ }
+
postCtx :: Context String
postCtx =
dateField "date" "%B %e, %Y" `mappend`