implement /comments.rss
This commit is contained in:
parent
f6b252e456
commit
776bf89dea
|
@ -272,6 +272,10 @@ class Comment < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def short_id_url
|
||||
self.story.short_id_url + "/_/comments/#{self.short_id}"
|
||||
end
|
||||
|
||||
def url
|
||||
self.story.comments_url + "/comments/#{self.short_id}"
|
||||
end
|
||||
|
|
23
app/views/comments/index.rss
Normal file
23
app/views/comments/index.rss
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<% coder = HTMLEntities.new %>
|
||||
<rss version="2.0">
|
||||
<channel>
|
||||
<title>lobste.rs<%= @title.present? ? ": " + h(@title) : "" %></title>
|
||||
<description><%= @title %></description>
|
||||
<link><%= root_url %>comments</link>
|
||||
|
||||
<% @comments.each do |comment| %>
|
||||
<item>
|
||||
<title>on <%= raw coder.encode(comment.story.title, :decimal) %></title>
|
||||
<link><%= comment.url %></link>
|
||||
<guid><%= comment.short_id_url %></guid>
|
||||
<author><%= comment.user.username %></author>
|
||||
<pubDate><%= comment.created_at.rfc2822 %></pubDate>
|
||||
<comments><%= comment.url %></comments>
|
||||
<description><%= raw coder.encode(comment.markeddown_comment,
|
||||
:decimal) %></description>
|
||||
</item>
|
||||
<% end %>
|
||||
</channel>
|
||||
</rss>
|
||||
|
Loading…
Reference in a new issue