home73k/lib/home73k_web/controllers/feed_controller.ex

17 lines
414 B
Elixir
Raw Normal View History

2021-04-06 18:13:57 -04:00
defmodule Home73kWeb.FeedController do
use Home73kWeb, :controller
plug :put_layout, false
plug :put_root_layout, false
2021-04-06 18:13:57 -04:00
alias Home73k.Blog
def rss(conn, _params) do
posts = Blog.list_posts()
last_build_date = posts |> List.first() |> Map.get(:date)
conn
|> put_resp_content_type("application/rss+xml")
|> render("rss.xml", posts: posts, last_build_date: last_build_date)
end
end