diff --git a/hakyll.cabal b/hakyll.cabal
--- a/hakyll.cabal
+++ b/hakyll.cabal
@@ -1,5 +1,5 @@
 Name:               hakyll
-Version:            2.4.3
+Version:            2.4.4
 
 Synopsis:           A simple static site generator library.
 Description:        A simple static site generator library, mainly aimed at
diff --git a/src/Text/Hakyll/File.hs b/src/Text/Hakyll/File.hs
--- a/src/Text/Hakyll/File.hs
+++ b/src/Text/Hakyll/File.hs
@@ -89,12 +89,15 @@
 
 -- | Get the relative url to the site root, for a given (absolute) url
 toRoot :: FilePath -> FilePath
-toRoot = emptyException . joinPath . map parent . splitPath
-       . takeDirectory . removeLeadingSeparator
+toRoot = emptyException . joinPath . map parent
+       . filter relevant . splitPath . takeDirectory
   where
     parent = const ".."
     emptyException [] = "."
     emptyException x  = x
+    relevant "." = False
+    relevant "/" = False
+    relevant _   = True
 
 -- | Check if a file is in a given directory.
 --
