Skip to content
Snippets Groups Projects
Unverified Commit af913e00 authored by Eduardo Trujillo's avatar Eduardo Trujillo
Browse files

feat(app): Render RSS feed

parent 9b042624
No related branches found
No related tags found
No related merge requests found
......@@ -28,11 +28,11 @@ data SiteConfiguration = SiteConfiguration
, siteGaId :: String
}
-- CONFIGURATION --------------------------------------------------------------
serveConf :: HakyllServeConfiguration
serveConf = def & hscHakyllConfiguration .~ hakyllConf
-- CONFIGURATION --------------------------------------------------------------
hakyllConf :: Configuration
hakyllConf = defaultConfiguration
{ deployCommand
......@@ -48,6 +48,15 @@ siteConf = SiteConfiguration
, siteGaId = "UA-47694260-1"
}
feedConf :: FeedConfiguration
feedConf = FeedConfiguration
{ feedTitle = "Chromabits"
, feedDescription = "A personal blog"
, feedAuthorName = "Eduardo Trujillo"
, feedAuthorEmail = "ed+contact@chromabits.com"
, feedRoot = "https://chromabits.com"
}
colors :: [String]
colors = ["purple", "yellow", "orange", "red", "cyan", "green", "blue"]
......@@ -125,6 +134,8 @@ main = hakyllServeWith serveConf $ do
<> postCtx
pandocHtml5Compiler
>>= loadAndApplyTemplate "templates/post-body.html" ctx
>>= saveSnapshot "content-body"
>>= loadAndApplyTemplate "templates/post.html" ctx
>>= saveSnapshot "content"
>>= loadAndApplyTemplate "templates/full-post.html" ctx
......@@ -236,6 +247,15 @@ main = hakyllServeWith serveConf $ do
match "templates/*" $ compile templateCompiler
create ["feed.rss"] $ do
route idRoute
compile $ do
let context = postCtx <> bodyField "description"
posts <- fmap (take 10) . recentFirst
=<< loadAllSnapshots ("posts/*" .&&. hasNoVersion) "content-body"
renderRss feedConf context posts
-- CONTEXTS -------------------------------------------------------------------
siteCtx :: Context String
......
$body$
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment