   (if-let [e (fs/extension s)] (clojure.string/replace s e "") s))
 
 (defn strip-file-info
-  [file-record]
-  (dissoc file-record :path :mod-time))
+  [page-record]
+  (dissoc page-record :path :mod-time))
 
-(defn get-site-map
-  []
-  (deref *site-map*))
-  
 (defn humane-site-map
-  []
+  [site-map]
   (clojure.walk/postwalk (fn [form]
-                           (cond (file-record? form)
+                           (cond (page-record? form)
                                  (strip-file-info form)
                                  
                                  (keyword? form)
                                  (-> form name strip-extension keyword)
 
                                  :default form))
-                         (get-site-map)))
+                         site-map))
 
 (defmulti render-file
   "Takes as its first argument a map of the type returned by `build-file!`,
   and as its second argument a lazy sequence of the lines of the corresponding
   file. Should return a string which will be written to the output file."
-
   (comp fs/extension :path))
 
 (defmethod render-file ".md"
-  [file-record content-lines]
+  [page-record content-lines]
   (hiccup/html
    [:html
-    [:head [:title (:title file-record)]]
+    [:head [:title (:title page-record)]]
     [:body (md-to-html-string (join "\n" content-lines))]]))
 
 (defn mk-output

   (str (join "/" (cons root (drop 2 (fs/split (strip-extension path)))))
        ".html")))

(defn compile-file!
  [build-path [file-record lines]]
  (let [output (mk-output build-path (:path file-record))]
    (with-parent-dir output
      (fn []
        (with-open [writer (clojure.java.io/writer output)]
          (binding [site (assoc (humane-site-map)
                                :current-page
                                (strip-file-info file-record))]
            (.write writer (render-file file-record lines))))))))

(defn compile-content!
  [content-root build-path]
  (do-directory! (comp (partial compile-file! build-path)
                       build-file!)
                 (complement fs/directory?)
                 content-root))

                        (join "/" (concat (fs/split root-dir)
                                          (list "content"))))]
      (build-site-map! content-root)
      (compile-content! @*site-map* content-root build-root))))
