create RSS and Atom feeds
This commit is contained in:
parent
d40b04a5e3
commit
111ea2e3f1
1 changed files with 33 additions and 0 deletions
33
src/Main.hs
33
src/Main.hs
|
@ -110,6 +110,20 @@ main = do
|
|||
defaultCtx full
|
||||
>>= relativizeUrls
|
||||
|
||||
create ["atom.xml"] $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
loadAllSnapshots "site/posts/*.md" "content"
|
||||
>>= recentFirst
|
||||
>>= renderAtom feedConf feedCtx
|
||||
|
||||
create ["rss.xml"] $ do
|
||||
route idRoute
|
||||
compile $ do
|
||||
loadAllSnapshots "site/posts/*.md" "content"
|
||||
>>= recentFirst
|
||||
>>= renderRss feedConf feedCtx
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
myRoute :: Routes
|
||||
|
@ -135,6 +149,25 @@ config = defaultConfiguration
|
|||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
feedCtx :: Context String
|
||||
feedCtx = mconcat
|
||||
[ bodyField "description"
|
||||
, defaultContext
|
||||
]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
feedConf :: FeedConfiguration
|
||||
feedConf = FeedConfiguration
|
||||
{ feedTitle = "Chaosone news"
|
||||
, feedDescription = "News from eastern european hackerspaces"
|
||||
, feedAuthorName = "Chaoszone members"
|
||||
, feedAuthorEmail = "nek0@chaoszone.cz"
|
||||
, feedRoot = "https://chaoszone.cz"
|
||||
}
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
sortIdentifiersByDate :: [Identifier] -> [Identifier]
|
||||
sortIdentifiersByDate =
|
||||
sortBy byDate
|
||||
|
|
Loading…
Reference in a new issue