       _   -> "#{day}th"
     end
 
-    %{metadata | :published => "#{month} #{day}, #{year}"}
+    timestamp = Date.convert(date, :secs)
+
+    Map.put(%{metadata | :published => "#{month} #{day}, #{year}"}, :timestamp, timestamp)
   end
 
   defp read_articles([], articles), do: articles

    render conn, "about.html"
  end

  defp format_date(%{:published => published} = metadata) do
    {:ok, date} = DateFormat.parse(published, "{M}/{D}/{YYYY}")


    read_articles(files, [])
  end

  defp get_article_files() do
    Application.app_dir(:marc_cx, "priv/articles")
    |> File.ls!
  end

  defp get_articles() do
    get_article_files
    |> read_articles
    |> extract_metadata
    |> format_dates
    |> sort_by_date :desc
  end

  defp extract_metadata(articles) do
    Enum.map(articles, fn (article) ->
      [slug | content] = article

      metadata = Markdown.get_metadata(content)

      Map.put(metadata, :slug, slug)
    end)
  end

  defp sort_by_date(articles, :desc) do
    Enum.sort(articles, fn (a, b) ->
      a.timestamp > b.timestamp
    end)
  end

  defp sort_by_date(articles, :asc) do
    Enum.sort(articles, fn (a, b) ->
      a.timestamp < b.timestamp
    end)
  end
end
