   [path]
   (-> path (relative-path) (strip-extensions) (str ".html")))
 
-(defn canonical-url
-  "Given some url, ensures that it is an absolute url. If url is a path to
-  some index.html, return a url to the parent directory."
-  [url]
-  (str "/" (-> url (clojure.string/replace "index.html" "") (strip-extensions))))
-
 (defn file-mapping
   [info root file]
   (let [path (.getPath file)]

         (filter source-file?)
         (map #(file-mapping info root %)))))

(defn resource-key
  "Convert a url relative to the root of the site into a sequence of its path parts
  ,omitting any extensions in the url."
  [url]
  (-> url (strip-extensions) (fs/split)))

(defn mapping->site
  "Convert a sequence of [path url] pairs to a map structure representing

  [mapping]
  (reduce (fn [site [path inf]]
            (assoc-in site
                      (site-nav (:url inf))
                      (update-in inf [:url] canonical-url)))
          {}
          mapping))
