             input-meta (meta-by-ext input-fs extensions)
             output-meta (doall
                          (for [{:keys [path parsed filename] :as entry*} input-meta]
-                           (let [page-filepath (string/replace path #"(?i).[a-z]+$" output-extension)
+                           (let [new-path (->> output-extension
+                                               (string/replace path #"(?i).[a-z]+$")
+                                               (perun/create-filepath (:out-dir options)))
                                  entry (-> entry*
-                                           (assoc :path page-filepath
-                                                  :original-path path)
-                                           (dissoc :parsed :original))]
-                             (perun/create-file tmp page-filepath parsed)
+                                           (dissoc :parsed :original)
+                                           (merge {:original-path path
+                                                   :out-dir (:out-dir options)}
+                                                  (pm/path-meta new-path global-meta)))]
+                             (perun/create-file tmp new-path parsed)
                              entry)))
             new-fs (-> input-fs
                        (commit tmp)

    [circleci/clj-yaml "0.5.5"]])

(def ^:private +markdown-defaults+
  {:meta {:original true
          :include-rss true
          :include-atom true}})


   This task will look for files ending with `md` or `markdown`
   and add a `:parsed` key to their metadata containing the
   HTML resulting from processing markdown file's content"
  [d out-dir  OUTDIR  str "the output directory"
   m meta     META    edn "metadata to set on each entry; keys here will be overridden by metadata in each file"
   o options  OPTS    edn "options to be passed to the markdown parser"]
  (let [pod     (create-pod markdown-deps)
        options (merge +markdown-defaults+ *opts*)]
    (content-pre-wrap
