need to have functionality to read posts for rss and the like use the url made idk
This commit is contained in:
parent
bfc43ed5e8
commit
3c68c4f344
1 changed files with 11 additions and 0 deletions
11
app/Main.hs
11
app/Main.hs
|
@ -49,6 +49,9 @@ buildSite = do
|
||||||
postPaths <- Shake.getDirectoryFiles "" postGlobs
|
postPaths <- Shake.getDirectoryFiles "" postGlobs
|
||||||
Shake.need $ map indexHtmlOutputPath postPaths
|
Shake.need $ map indexHtmlOutputPath postPaths
|
||||||
|
|
||||||
|
-- posts list
|
||||||
|
Shake.need [indexHtmlOutputPath "posts"]
|
||||||
|
|
||||||
-- remaining pages, index.xml = rss feed
|
-- remaining pages, index.xml = rss feed
|
||||||
Shake.need $ map (outputDir </>) ["index.html", "index.xml"]
|
Shake.need $ map (outputDir </>) ["index.html", "index.xml"]
|
||||||
|
|
||||||
|
@ -58,6 +61,7 @@ buildRules = do
|
||||||
assets
|
assets
|
||||||
pages
|
pages
|
||||||
postsRule
|
postsRule
|
||||||
|
postList
|
||||||
rss
|
rss
|
||||||
|
|
||||||
-- make a rule of the pattern outputDir/asset_name which copes from outputDir/../pages
|
-- make a rule of the pattern outputDir/asset_name which copes from outputDir/../pages
|
||||||
|
@ -140,6 +144,13 @@ home =
|
||||||
applyTemplateAndWrite "default.html" page target
|
applyTemplateAndWrite "default.html" page target
|
||||||
Shake.putInfo $ "Built " <> 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 :: Rules ()
|
||||||
rss =
|
rss =
|
||||||
outputDir </> "index.xml" %> \target -> do
|
outputDir </> "index.xml" %> \target -> do
|
||||||
|
|
Loading…
Reference in a new issue