added feed stuffs
This commit is contained in:
parent
23b5fdc920
commit
22fd5291b8
28
site.hs
28
site.hs
@ -49,6 +49,7 @@ main = do
|
||||
route $ cleanRoute
|
||||
compile $ pandocCompiler
|
||||
>>= loadAndApplyTemplate "templates/post.html" postCtx
|
||||
>>= saveSnapshot "content"
|
||||
>>= loadAndApplyTemplate "templates/default.html" postCtx
|
||||
>>= relativizeUrls
|
||||
>>= cleanIndexUrls
|
||||
@ -69,6 +70,24 @@ main = do
|
||||
|
||||
match "templates/*" $ compile templateBodyCompiler
|
||||
|
||||
create ["atom.xml"] $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
let feedCtx = postCtx <>
|
||||
bodyField "description"
|
||||
posts <- fmap (take 10) . recentFirst
|
||||
=<< loadAllSnapshots "posts/*" "content"
|
||||
renderAtom feedConfig feedCtx posts
|
||||
|
||||
create ["rss.xml"] $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
let feedCtx = postCtx <>
|
||||
bodyField "description"
|
||||
posts <- fmap (take 10) . recentFirst
|
||||
=<< loadAllSnapshots "posts/*" "content"
|
||||
renderRss feedConfig feedCtx posts
|
||||
|
||||
ctx :: Context String
|
||||
ctx = defaultContext <>
|
||||
faviconsField
|
||||
@ -98,3 +117,12 @@ cleanIndex url
|
||||
| idx `isSuffixOf` url = take (length url - length idx) url
|
||||
| otherwise = url
|
||||
where idx = "index.html"
|
||||
|
||||
feedConfig :: FeedConfiguration
|
||||
feedConfig = FeedConfiguration {
|
||||
feedTitle = "Regular Flolloping"
|
||||
, feedDescription = "tA's Blog"
|
||||
, feedAuthorName = "Shaun Kerr"
|
||||
, feedAuthorEmail = "s@p7.co.nz"
|
||||
, feedRoot = "https://regularflolloping.com"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user