     File.rm_rf! dstdir
     File.mkdir_p! dstdir
 
-    infolist = mkinfo(dir, proj, files, [])
-    tasks_post = Enum.map infolist, &(Task.async Serum.Build, :post_task, [srcdir, dstdir, proj, &1, template_post])
+    infolist = mkinfo(dir, files, [])
+    tasks_post = Enum.map infolist, &(Task.async Serum.Build, :post_task, [srcdir, dstdir, &1, template_post])
 
     IO.puts "Generating posts index..."
     File.open! "#{dstdir}index.html", [:write, :utf8], fn device ->

  end

  defp genpage(contents, ctx) do
    template = Agent.get Global, &(Map.get &1, "template_base")
    contents = process_links contents, ctx
    render template, ctx ++ [contents: contents, navigation: Agent.get(Global, &(Map.get &1, :navstub))]
  end

  defp render(template, assigns) do
    {html, _} = Code.eval_quoted template, [assigns: assigns]
    html
  end

  defp mkinfo(dir, proj, [h|t], l) do
    [year, month, day|_] = h |> String.split("-") |> Enum.map(fn x ->
      case Integer.parse(x) do
        {x, _} -> x


  def build_pages(dir, info) do
    template = Agent.get Global, &(Map.get &1, "template_page")

    IO.puts "Cleaning pages..."

    "#{dir}site/"
    |> File.ls!
    |> Enum.filter(&(String.ends_with? &1, ".html"))
    |> Enum.each(&(File.rm_rf! "#{dir}site/#{&1}"))

    info
    |> Enum.map(&(Task.async Serum.Build, :page_task, [dir, &1, template]))
    |> Enum.each(&(Task.await &1))
  end

  def page_task(dir, info, template) do
    txt = File.read!("#{dir}pages/#{info.name}.#{info.type}")
    html = case info.type do
      "md" -> Earmark.to_html txt
      "html" -> txt
    end
    html = template
           |> render([contents: html])
           |> genpage([page_title: info.title])
    File.open! "#{dir}site/#{info.name}.html", [:write, :utf8], fn device ->
      IO.write device, html
    end
