mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 10:03:43 +08:00
195cdaec11
RSS spec says the author tag should be an email address, forcing us to put in a junk no-reply@example.com email. Instead, we should use dc:creator, which allows us to use any name we want for the user.
40 lines
2.2 KiB
Plaintext
40 lines
2.2 KiB
Plaintext
<?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>
|
|
<% lang = SiteSetting.find_by_name('default_locale').try(:value) %>
|
|
<% site_email = SiteSetting.find_by_name('contact_email').try(:value) %>
|
|
<title><%= @title %></title>
|
|
<link><%= @link %></link>
|
|
<description><%= @description %></description>
|
|
<% if lang %><language><%= lang%></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| %>
|
|
<% topic_url = topic.url -%>
|
|
<item>
|
|
<title><%= topic.title %></title>
|
|
<dc:creator><![CDATA[<%= "@#{topic.user.username}#{" #{topic.user.name}" if (topic.user.name.present? && SiteSetting.enable_names?)}" -%>]]></dc:creator>
|
|
<category><%= topic.category.name %></category>
|
|
<description><![CDATA[
|
|
<p><%= t('author_wrote', author: link_to("@#{topic.user.username}", "#{Discourse.base_url}/users/#{topic.user.username_lower}")).html_safe %></p>
|
|
<blockquote>
|
|
<%= topic.posts.first.cooked.html_safe %>
|
|
</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>
|
|
<guid isPermaLink="false">topic-<%= topic.id %></guid>
|
|
<source url="<%= topic_url %>.rss"><%= topic.title %></source>
|
|
</item>
|
|
<% end %>
|
|
<% end %>
|
|
</channel>
|
|
</rss>
|