defmodule FirehoseWeb.PageController do
  use FirehoseWeb, :controller

  def home(conn, _params) do
    recent_posts =
      (Firehose.EngineeringBlog.recent_posts(3) ++
         Firehose.ReleaseNotes.recent_posts(3))
      |> Enum.sort_by(& &1.date, {:desc, Date})
      |> Enum.take(6)

    render(conn, :home, recent_posts: recent_posts)
  end

  def contact(conn, _params) do
    render(conn, :contact)
  end
end
