discourse/app/views/topics/show.rss.erb
2013-12-15 01:17:39 -08:00

35 lines
1.6 KiB
Text

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<% topic_url = Discourse.base_url + @topic_view.relative_url %>
<% lang = SiteSetting.find_by_name('default_locale').try(:value) %>
<title><%= @topic_view.title %></title>
<link><%= topic_url %></link>
<description><%= @topic_view.posts.first.raw %></description>
<% if lang %>
<language><%= lang %></language>
<% end %>
<lastBuildDate><%= @topic_view.topic.created_at.rfc2822 %></lastBuildDate>
<category><%= @topic_view.topic.category.name %></category>
<atom:link href="<%= topic_url %>.rss" rel="self" type="application/rss+xml" />
<% @topic_view.recent_posts.each do |post| %>
<% next unless post.user %>
<item>
<title><%= @topic_view.title %> at <%= post.created_at %></title>
<author><%= "@#{post.user.username} (#{post.user.name})" -%></author>
<description><![CDATA[
<% post_url = Discourse.base_url + post.url %>
<p><%= t('author_wrote', author: link_to(post.user.name, post.user)).html_safe %></p>
<blockquote>
<%= post.cooked.html_safe %>
</blockquote>
<p><%= link_to t('read_full_topic'), post_url %></p>
]]></description>
<link><%= post_url %></link>
<pubDate><%= post.created_at.rfc2822 %></pubDate>
<guid><%= post_url %></guid>
<source url="<%= Discourse.base_url %><%= @topic_view.relative_url %>.rss"><%= @topic_view.title %></source>
</item>
<% end %>
</channel>
</rss>