discourse/app/views/list/list.rss.erb

46 lines
2.5 KiB
Plaintext
Raw Normal View History

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:discourse="http://www.discourse.org/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
2013-12-15 04:17:39 -05:00
<% lang = SiteSetting.find_by_name('default_locale').try(:value) %>
<% site_email = SiteSetting.find_by_name('contact_email').try(:value) %>
2013-07-05 16:49:06 -04:00
<title><%= @title %></title>
<link><%= @link %></link>
<description><%= @description %></description>
<% if lang %><language><%= lang.sub('_', '-')%></language><% end %>
<% if @topic_list.topics && @topic_list.topics.length > 0 %>
<lastBuildDate><%= @topic_list.topics.first.created_at.rfc2822 %></lastBuildDate>
<atom:link href="<%= @atom_link %>" rel="self" type="application/rss+xml" />
<% @topic_list.topics.each do |topic| %>
2015-05-11 01:20:24 -04:00
<% topic_url = topic.url -%>
2016-05-16 19:35:30 -04:00
<% username = topic.user ? topic.user.username : "" %>
<% name = topic.user ? topic.user.name : "" %>
<item>
<title><%= topic.title %></title>
2016-05-16 19:35:30 -04:00
<dc:creator><![CDATA[<%= "@#{username}#{" #{name}" if (name.present? && SiteSetting.enable_names?)}" -%>]]></dc:creator>
<category><%= topic.category.name %></category>
<description><![CDATA[
2016-05-16 19:35:30 -04:00
<% if username.present? %>
<p><%= t('author_wrote', author: link_to("@#{username}", "#{Discourse.base_url}/u/#{url_encode(topic.user.username_lower)}")).html_safe %></p>
2016-05-16 19:35:30 -04:00
<% end %>
<blockquote>
<%- if first_post = topic.ordered_posts.first %>
<%= first_post.cooked.html_safe %>
<%- end %>
</blockquote>
<p><%= t 'num_posts' %> <%= topic.posts_count %></p>
<p><%= t 'num_participants' %> <%= topic.participant_count %></p>
<p><%= link_to t('read_full_topic'), topic_url %></p>
]]></description>
<link><%= topic_url %></link>
<pubDate><%= topic.created_at.rfc2822 %></pubDate>
<discourse:topicPinned><%= topic.pinned_at ? 'Yes' : 'No' %></discourse:topicPinned>
<discourse:topicClosed><%= topic.closed ? 'Yes' : 'No' %></discourse:topicClosed>
<discourse:topicArchived><%= topic.archived ? 'Yes' : 'No' %></discourse:topicArchived>
2016-02-22 07:58:02 -05:00
<guid isPermaLink="false"><%= Discourse.current_hostname %>-topic-<%= topic.id %></guid>
<source url="<%= topic_url %>.rss"><%= topic.title %></source>
</item>
<% end %>
<% end %>
</channel>
</rss>