diff options
Diffstat (limited to 'src/Hakyll/Web/Urls')
-rw-r--r-- | src/Hakyll/Web/Urls/Relativize.hs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/Hakyll/Web/Urls/Relativize.hs b/src/Hakyll/Web/Urls/Relativize.hs index 0251cfe..068ae09 100644 --- a/src/Hakyll/Web/Urls/Relativize.hs +++ b/src/Hakyll/Web/Urls/Relativize.hs @@ -21,10 +21,7 @@ module Hakyll.Web.Urls.Relativize -------------------------------------------------------------------------------- -import Control.Arrow ((&&&), (>>^)) -import Control.Category (id) import Data.List (isPrefixOf) -import Prelude hiding (id) -------------------------------------------------------------------------------- @@ -36,11 +33,12 @@ import Hakyll.Web.Urls -------------------------------------------------------------------------------- -- | Compiler form of 'relativizeUrls' which automatically picks the right root -- path -relativizeUrlsCompiler :: Compiler Page Page -relativizeUrlsCompiler = getRoute &&& id >>^ uncurry relativize - where - relativize Nothing = id - relativize (Just r) = relativizeUrls $ toSiteRoot r +relativizeUrlsCompiler :: Page -> Compiler Page +relativizeUrlsCompiler page = do + route <- getRoute + return $ case route of + Nothing -> page + Just r -> relativizeUrls (toSiteRoot r) page -------------------------------------------------------------------------------- |