Add support for generating an XML sitemap

This commit is contained in:
Danielle McLean 2017-10-05 09:16:26 +11:00
parent 1c5939d863
commit 8c3a562c7d
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
4 changed files with 16 additions and 3 deletions
src/Handler

View file

@ -7,6 +7,8 @@
module Handler.Common where
import Data.FileEmbed (embedFile)
import Yesod.Sitemap
import Import
-- These handlers embed files in the executable at compile time to avoid a
@ -21,6 +23,14 @@ getKeybaseR :: Handler TypedContent
getKeybaseR = return $ TypedContent typePlain
$ toContent $(embedFile "config/keybase.txt")
getRobotsR :: Handler TypedContent
getRobotsR = return $ TypedContent typePlain
$ toContent $(embedFile "config/robots.txt")
getRobotsR :: Handler Text
getRobotsR = robots SitemapR
getSitemapR :: Handler TypedContent
getSitemapR = sitemap $ do
yield SitemapUrl
{ sitemapLoc = HomeR
, sitemapLastMod = Nothing
, sitemapChangeFreq = Just Daily
, sitemapPriority = Nothing
}