                          :js-file "js/main.js"
                          :js-dir "js/out"
                          :main-div "main-content"
-                         :default-title ""
-                         :allow-html5-history false}))
-
-;; (defonce page (r/atom "index.html"))
-;; (defonce page-state (r/atom {:has-history false}))
+                         :default-title ""}))
 
 (defonce history nil)
-
-(defn as-relative [f]
-  (clojure.string/replace f #"^/" ""))
 
 (defn demo-handler [state [id v1 v2 :as event]]
   (case id
     :content (do
                (let [title (if v2
-                             (str (:title-prefix @config) v2)
-                             (str (:default-title @config)))]
+                             (str (:title-prefix state) v2)
+                             (str (:default-title state)))]
                  (when r/is-client
                    (r/next-tick #(set! js/document.title title)))
                  (assoc state

  (let [fs (or (.-rswapfs a)
               (set! (.-rswapfs a) (array)))]
    (.push fs #(apply f % args))
    (if (< 1 (.-length fs))
      nil
      (let [f' (fn [state]
                 (let [s ((aget fs 0) state)]
                   (.shift fs)
                   (if (-> fs .-length pos?)
                     (recur s)
                     s)))]
        (swap! a f')))))

  (swap! config merge site-config)
  (when r/is-client
    (let [conf (when (exists? js/pageConfig)
                 (js->clj js/pageConfig :keywordize-keys true))]
      (swap! config merge conf)
      (init-history)
      (r/render-component (body)
                          (js/document.getElementById (:main-div @config))))))
