From 3c68c4f344f074729ce6883c92f5447da5776f04 Mon Sep 17 00:00:00 2001 From: Pagwin Date: Fri, 25 Oct 2024 23:33:12 -0400 Subject: [PATCH] need to have functionality to read posts for rss and the like use the url made idk --- app/Main.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Main.hs b/app/Main.hs index 843004d..3db3b73 100755 --- a/app/Main.hs +++ b/app/Main.hs @@ -49,6 +49,9 @@ buildSite = do postPaths <- Shake.getDirectoryFiles "" postGlobs Shake.need $ map indexHtmlOutputPath postPaths + -- posts list + Shake.need [indexHtmlOutputPath "posts"] + -- remaining pages, index.xml = rss feed Shake.need $ map (outputDir ) ["index.html", "index.xml"] @@ -58,6 +61,7 @@ buildRules = do assets pages postsRule + postList rss -- make a rule of the pattern outputDir/asset_name which copes from outputDir/../pages @@ -140,6 +144,13 @@ home = applyTemplateAndWrite "default.html" page target Shake.putInfo $ "Built " <> target +postList :: Rules () +postList = + outputDir "posts/index.html" %> \target -> do + postPaths <- Shake.getDirectoryFiles "" postGlobs + posts <- sortOn (Ord.Down . postDate) <$> forM postPaths readPost + applyTemplateAndWrite "posts.html" (HM.singleton "posts" posts) target + rss :: Rules () rss = outputDir "index.xml" %> \target -> do