discourse/app/views/topics/show.rss.erb
Alexander 8855a0bfbe RSS of a topic via new route
Adds TopicView#recent_posts; Post#by_newest, #with_user, #author_readable; User#readable_name
Autodiscovery tag in topic show HTML.
2013-02-26 14:54:17 -08:00

22 lines
1 KiB
Text

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title><%= @topic_view.title %></title>
<link><%= Discourse.base_url %><%= @topic_view.relative_url %></link>
<description><%= @topic_view.posts.first.raw %></description>
<atom:link href="<%= Discourse.base_url %><%= @topic_view.relative_url %>.rss" rel="self" type="application/rss+xml" />
<% @topic_view.recent_posts.each do |post| %>
<item>
<title><%= @topic_view.title %> at <%= post.created_at %></title>
<description><![CDATA[
<p><%= post.author_readable %> wrote:</p>
<%= post.cooked.html_safe %>
]]></description>
<link><%= Discourse.base_url %><%= post.url %></link>
<pubDate><%= post.created_at.rfc2822 %></pubDate>
<guid><%= Discourse.base_url %><%= post.url %></guid>
<source url="<%= Discourse.base_url %><%= @topic_view.relative_url %>.rss"><%= @topic_view.title %></source>
</item>
<% end %>
</channel>
</rss>