Skip to content

Instantly share code, notes, and snippets.

@joe-warren
Created September 29, 2024 16:26
Show Gist options
  • Save joe-warren/31ffdb2d688d6c8df72e6298c5069a6f to your computer and use it in GitHub Desktop.
Save joe-warren/31ffdb2d688d6c8df72e6298c5069a6f to your computer and use it in GitHub Desktop.
CompileTagFeeds.hs
let compileTagFeeds feedType feedExt feedCompiler =
tagsRules tags $ \tag pat -> version feedType $ do
route (setExtension feedExt)
compile $ do
(allPosts, ctx) <- loadPattern pat
posts <- recentFirst allPosts
let feedCtx = ctx `mappend` postCtx
tagDescription <- readTagDescriptionFile'
let feedConfiguration = myFeedConfiguration
{ feedTitle = feedTitle myFeedConfiguration <> " :: Only " <> tag <> " Posts"
, feedDescription = tagDescription tag
}
feedCompiler feedConfiguration feedCtx posts
compileTagFeeds "atom" "atom.xml" renderAtom
compileTagFeeds "rss" "rss" renderRss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment