summaryrefslogtreecommitdiff
path: root/src/Hakyll/Web/Util/Url.hs
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-03-08 11:03:07 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-03-08 11:03:07 +0100
commitcf71e295467aa75606d491627541610e17dd1c64 (patch)
treec02fc26982520fefb83e21df2fb15de0dd3e5532 /src/Hakyll/Web/Util/Url.hs
parent1ea56781300e47c02ffd0ec055bfeb3539a2e1e1 (diff)
downloadhakyll-cf71e295467aa75606d491627541610e17dd1c64.tar.gz
Make toSiteRoot work with /xxx URL's
Diffstat (limited to 'src/Hakyll/Web/Util/Url.hs')
-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 (== '/')