diff --git a/Yesod/Definitions.hs b/Yesod/Definitions.hs index 97243d06..65a726fd 100644 --- a/Yesod/Definitions.hs +++ b/Yesod/Definitions.hs @@ -17,6 +17,7 @@ module Yesod.Definitions ( Verb (..) , toVerb , Resource + , Approot (..) ) where import qualified Hack @@ -31,3 +32,8 @@ toVerb Hack.POST = Post toVerb _ = Get type Resource = [String] + +-- | An absolute URL to the base of this application. This can almost be done +-- programatically, but due to ambiguities in different ways of doing URL +-- rewriting for (fast)cgi applications, it should be supplied by the user. +newtype Approot = Approot { unApproot :: String } diff --git a/Yesod/Helpers/Sitemap.hs b/Yesod/Helpers/Sitemap.hs index bc1455a5..410cde5c 100644 --- a/Yesod/Helpers/Sitemap.hs +++ b/Yesod/Helpers/Sitemap.hs @@ -22,6 +22,7 @@ module Yesod.Helpers.Sitemap , SitemapChangeFreq (..) ) where +import Yesod.Definitions import Yesod.Handler import Yesod.Response import Web.Encodings @@ -92,7 +93,6 @@ sitemap urls' = do urls <- liftIO urls' return $ reps $ SitemapResponse req urls -robots :: Handler -robots = do - ar <- approot +robots :: Approot -> Handler +robots (Approot ar) = do return $ genResponse "text/plain" $ "Sitemap: " ++ ar ++ "sitemap.xml"