     html = template
            |> render([contents: html])
            |> genpage([page_title: info.title])
+    [_|subdir] = info.name |> String.split("/") |> Enum.reverse
+    subdir = case subdir do
+      [] -> ""
+      [x] -> x <> "/"
+      [_|_] -> (subdir |> Enum.reverse |> Enum.join("/")) <> "/"
+    end
+    if subdir != "", do: File.mkdir_p! "#{dest}#{subdir}"
     File.open! "#{dest}#{info.name}.html", [:write, :utf8], fn device ->
       IO.write device, html
     end

            |> Enum.filter(&(String.ends_with? &1, ".md"))
            |> Enum.map(&(String.replace &1, ~r/\.md$/, ""))
            |> Enum.sort
    IO.puts "Cleaning directory `#{dstdir}`..."
    File.rm_rf! dstdir
    File.mkdir_p! dstdir

    Enum.each launch_post(mode, files, srcdir, dstdir, template_post), &Task.await&1

    template = Agent.get Global, &(Map.get &1, "template_page")
    info = Agent.get Global, &(Map.get &1, :pageinfo)

    case mode do
      :parallel ->
        info
