                  "<meta charset=\"utf-8\">
     <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">
     <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"
-                 
+
                  [:title title]
-                 
+
                  "<link href=\"/bootstrap-3.3.4-dist/css/bootstrap.min.css\" rel=\"stylesheet\">
 
                  <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->

           " / " [:a {:href (str "/" folder)} kiinteistön-nimi]
           " / " tiedoston-nimi]

          [:a {:href (str "/" folder) :style "color: black;"} [:h1 kiinteistön-nimi]] 
          
          [:a {:href (str "/get/" folder "/" file) :class "file-download-link"}
           tiedoston-nimi]

          [:div {:style "margin-left: 10px; display: inline-block"}
           "(" (-> (str "files/" folder "/" file) 
                   (URLDecoder/decode)
                   (File.)
                   last-modified-date
                   date-string)
           ")"]
          
          
          [:div {:style "margin-top: 20px"}
           (like-button (str site-url "/" folder "/" file))]
          
          [:h2 {:class "comments-header"} "Kommentit"]
          (disqus (str folder "/" file) (str kiinteistön-nimi " / " tiedoston-nimi)))))


            [:h2 "Muut"]
            muut)))

(def ips-atom (atom []))

(defn add-ip! [ip]
  (swap! ips-atom (fn [ips]
                    (take 10 (conj ips {:ip ip
                                        :time (date-to-map (Date.))})))))

(defn report-ips [ips]
  (hiccup/html
   [:ul
    (map (fn [ip]
           [:li  (date-time-string (:time ip)) [:br]
            [:strong (:ip ip)]])
         ips)]))

(defn app []
  (compojure/routes (compojure/GET "/" []
                                   (front-page))

                    (compojure/GET "/ip" request
                                   (add-ip! (:remote-addr request))
                                   (report-ips @ips-atom))

                    (compojure/GET ["/get/:folder/:file" :folder #"[^/]+" :file #"[^/]+"]  [folder file]
                                   (do (timbre/info (str "load file " (URLDecoder/decode folder) "/" (URLDecoder/decode file)))
                                       (response/file-response (str files-directory "/" (URLDecoder/decode folder) "/" (URLDecoder/decode file)))))

                    (compojure/GET ["/:folder" :folder #"[^/]+"]  [folder]
                                     (show-folder folder))

                    (compojure/GET ["/:folder/:file" :folder #"[^/]+" :file #"[^/]+"] [folder file]
                                     (show-file folder file))))

(def handler (-> (app)
                 (file/wrap-file "resources")))
