mirror of
https://github.com/discourse/discourse.git
synced 2025-02-19 18:11:18 +00:00
Merge pull request #1747 from alxndr/rss-tweak
tweak RSS elements for W3C compatibility
This commit is contained in:
commit
40327c25e8
@ -2,22 +2,21 @@
|
|||||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
<channel>
|
<channel>
|
||||||
<% lang = SiteSetting.find_by_name('default_locale').try(:value) %>
|
<% lang = SiteSetting.find_by_name('default_locale').try(:value) %>
|
||||||
|
<% site_email = SiteSetting.find_by_name('contact_email').try(:value) %>
|
||||||
<title><%= @title %></title>
|
<title><%= @title %></title>
|
||||||
<link><%= @link %></link>
|
<link><%= @link %></link>
|
||||||
<description><%= @description %></description>
|
<description><%= @description %></description>
|
||||||
<% if lang %>
|
<%= "<language>#{lang}</language>" if lang %>
|
||||||
<language><%= lang %></language>
|
|
||||||
<% end %>
|
|
||||||
<lastBuildDate><%= @topic_list.topics.first.created_at.rfc2822 %></lastBuildDate>
|
<lastBuildDate><%= @topic_list.topics.first.created_at.rfc2822 %></lastBuildDate>
|
||||||
<atom:link href="<%= @atom_link %>" rel="self" type="application/rss+xml" />
|
<atom:link href="<%= @atom_link %>" rel="self" type="application/rss+xml" />
|
||||||
<% @topic_list.topics.each do |topic| %>
|
<% @topic_list.topics.each do |topic| %>
|
||||||
<% topic_url = Discourse.base_url + topic.relative_url -%>
|
<% topic_url = Discourse.base_url + topic.relative_url -%>
|
||||||
<item>
|
<item>
|
||||||
<title><%= topic.title %></title>
|
<title><%= topic.title %></title>
|
||||||
<author><%= "@#{topic.user.username} (#{topic.user.name})" -%></author>
|
<author><%= "#{site_email} (@#{topic.user.username}#{" #{topic.user.name}" if topic.user.name.present?})" -%></author>
|
||||||
<category><%= topic.category.name %></category>
|
<category><%= topic.category.name %></category>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
<p><%= t('author_wrote', author: link_to(topic.user.name, topic.user)).html_safe %></p>
|
<p><%= t('author_wrote', author: link_to(topic.user.name, userpage_url(topic.user))).html_safe %></p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<%= topic.posts.first.cooked.html_safe %>
|
<%= topic.posts.first.cooked.html_safe %>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
@ -3,23 +3,22 @@
|
|||||||
<channel>
|
<channel>
|
||||||
<% topic_url = Discourse.base_url + @topic_view.relative_url %>
|
<% topic_url = Discourse.base_url + @topic_view.relative_url %>
|
||||||
<% lang = SiteSetting.find_by_name('default_locale').try(:value) %>
|
<% lang = SiteSetting.find_by_name('default_locale').try(:value) %>
|
||||||
|
<% site_email = SiteSetting.find_by_name('contact_email').try(:value) %>
|
||||||
<title><%= @topic_view.title %></title>
|
<title><%= @topic_view.title %></title>
|
||||||
<link><%= topic_url %></link>
|
<link><%= topic_url %></link>
|
||||||
<description><%= @topic_view.posts.first.raw %></description>
|
<description><%= @topic_view.posts.first.raw %></description>
|
||||||
<% if lang %>
|
<%= "<language>#{lang}</language>" if lang %>
|
||||||
<language><%= lang %></language>
|
|
||||||
<% end %>
|
|
||||||
<lastBuildDate><%= @topic_view.topic.created_at.rfc2822 %></lastBuildDate>
|
<lastBuildDate><%= @topic_view.topic.created_at.rfc2822 %></lastBuildDate>
|
||||||
<category><%= @topic_view.topic.category.name %></category>
|
<category><%= @topic_view.topic.category.name %></category>
|
||||||
<atom:link href="<%= topic_url %>.rss" rel="self" type="application/rss+xml" />
|
<atom:link href="<%= topic_url %>.rss" rel="self" type="application/rss+xml" />
|
||||||
<% @topic_view.recent_posts.each do |post| %>
|
<% @topic_view.recent_posts.each do |post| %>
|
||||||
<% next unless post.user %>
|
<% next unless post.user %>
|
||||||
<item>
|
<item>
|
||||||
<title><%= @topic_view.title %> at <%= post.created_at %></title>
|
<title><%= @topic_view.title %></title>
|
||||||
<author><%= "@#{post.user.username} (#{post.user.name})" -%></author>
|
<author><%= "#{site_email} (@#{post.user.username}#{" #{post.user.name}" if post.user.name.present?})" -%></author>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
<% post_url = Discourse.base_url + post.url %>
|
<% post_url = Discourse.base_url + post.url %>
|
||||||
<p><%= t('author_wrote', author: link_to(post.user.name, post.user)).html_safe %></p>
|
<p><%= t('author_wrote', author: link_to(post.user.name, userpage_url(post.user))).html_safe %></p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
<%= post.cooked.html_safe %>
|
<%= post.cooked.html_safe %>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
@ -140,7 +140,7 @@ Discourse::Application.routes.draw do
|
|||||||
get 'user_preferences' => 'users#user_preferences_redirect'
|
get 'user_preferences' => 'users#user_preferences_redirect'
|
||||||
get 'users/:username/private-messages' => 'user_actions#private_messages', constraints: {username: USERNAME_ROUTE_FORMAT}
|
get 'users/:username/private-messages' => 'user_actions#private_messages', constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||||
get 'users/:username/private-messages/:filter' => 'user_actions#private_messages', constraints: {username: USERNAME_ROUTE_FORMAT}
|
get 'users/:username/private-messages/:filter' => 'user_actions#private_messages', constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||||
get 'users/:username' => 'users#show', constraints: {username: USERNAME_ROUTE_FORMAT}
|
get 'users/:username' => 'users#show', as: 'userpage', constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||||
put 'users/:username' => 'users#update', constraints: {username: USERNAME_ROUTE_FORMAT}
|
put 'users/:username' => 'users#update', constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||||
get 'users/:username/preferences' => 'users#preferences', constraints: {username: USERNAME_ROUTE_FORMAT}, as: :email_preferences
|
get 'users/:username/preferences' => 'users#preferences', constraints: {username: USERNAME_ROUTE_FORMAT}, as: :email_preferences
|
||||||
get 'users/:username/preferences/email' => 'users#preferences', constraints: {username: USERNAME_ROUTE_FORMAT}
|
get 'users/:username/preferences/email' => 'users#preferences', constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user