summaryrefslogtreecommitdiff
path: root/src/Hakyll/Web/Util
diff options
context:
space:
mode:
Diffstat (limited to 'src/Hakyll/Web/Util')
-rw-r--r--src/Hakyll/Web/Util/Url.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Hakyll/Web/Util/Url.hs b/src/Hakyll/Web/Util/Url.hs
index 8a02ef3..a0702d8 100644
--- a/src/Hakyll/Web/Util/Url.hs
+++ b/src/Hakyll/Web/Util/Url.hs
@@ -24,8 +24,10 @@ toUrl url = '/' : url
-- | Get the relative url to the site root, for a given (absolute) url
--
toSiteRoot :: String -> String
-toSiteRoot = emptyException . joinPath . map parent . splitPath . takeDirectory
+toSiteRoot = emptyException . joinPath . map parent
+ . splitPath . takeDirectory . dropLeadingSlash
where
parent = const ".."
emptyException [] = "."
emptyException x = x
+ dropLeadingSlash = dropWhile (== '/')