<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title><%= title(@view_module, @view_template, assigns) %></title>
    <description><%= excerpt(@view_module, @view_template, assigns) %></description>
    <link><%= Legendary.Content.Router.Helpers.url(Legendary.CoreWeb.Endpoint) %></link>
    <atom:link href="<%= Legendary.Content.Router.Helpers.url(Legendary.CoreWeb.Endpoint) %><%= @feed_url %>" rel="self" type="application/rss+xml" />

<%= for post <- @posts do %>
    <item>
      <title><%= post.title |> HtmlSanitizeEx.strip_tags() %></title>
      <description>
        <%= post.content |> process_content |> html_escape |> safe_to_string %>
      </description>
      <pubDate><%=
        post.date
        |> DateTime.from_naive!("Etc/UTC")
        |> Timex.format!("{WDshort}, {D} {Mshort} {YYYY} {h24}:{m}:{s} {Z}")
      %></pubDate>
      <guid isPermaLink="true"><%= post.guid %></guid>
    </item>
<% end %>
  </channel>
</rss>
