diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-03-08 11:03:07 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2011-03-08 11:03:07 +0100 |
commit | cf71e295467aa75606d491627541610e17dd1c64 (patch) | |
tree | c02fc26982520fefb83e21df2fb15de0dd3e5532 /src | |
parent | 1ea56781300e47c02ffd0ec055bfeb3539a2e1e1 (diff) | |
download | hakyll-cf71e295467aa75606d491627541610e17dd1c64.tar.gz |
Make toSiteRoot work with /xxx URL's
Diffstat (limited to 'src')
-rw-r--r-- | src/Hakyll/Web/RelativizeUrls.hs | 2 | ||||
-rw-r--r-- | src/Hakyll/Web/Util/Url.hs | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Hakyll/Web/RelativizeUrls.hs b/src/Hakyll/Web/RelativizeUrls.hs index 2de4a0e..06b4ae2 100644 --- a/src/Hakyll/Web/RelativizeUrls.hs +++ b/src/Hakyll/Web/RelativizeUrls.hs @@ -31,7 +31,7 @@ import Hakyll.Core.Compiler import Hakyll.Web.Page import Hakyll.Web.Util.Url --- | Compiler form of 'compressCss' which automatically picks the right root +-- | Compiler form of 'relativizeUrls' which automatically picks the right root -- path -- relativizeUrlsCompiler :: Compiler (Page String) (Page String) 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 (== '/') |