diff --git a/app/site.hs b/app/site.hs index 8a7ed28c981cd5f3cff4307bb0d023d68105bf91..6317420b0d940ac67176cc498926a203e52c316b 100644 --- a/app/site.hs +++ b/app/site.hs @@ -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 diff --git a/templates/post-body.html b/templates/post-body.html new file mode 100644 index 0000000000000000000000000000000000000000..36d66c2760f2aad0a1ca72d1796e9d09220c4e1c --- /dev/null +++ b/templates/post-body.html @@ -0,0 +1 @@ +$body$