journalduhacker/app/views/home/rss.erb

32 lines
1.2 KiB
Plaintext

<?xml version="1.0" encoding="UTF-8" ?>
<% coder = HTMLEntities.new %>
<rss version="2.0">
<channel>
<title><%= Rails.application.name %><%= @title.present? ?
": " + h(@title) : "" %></title>
<description><%= @title %></description>
<link><%= root_url + (@newest ? "newest" : "") %></link>
<% @stories.each do |story| %>
<item>
<title><%= raw coder.encode(story.title, :decimal) %></title>
<link><%= story.url_or_comments_url %></link>
<guid isPermaLink="false"><%= story.short_id_url %></guid>
<author><%= story.user.username %></author>
<pubDate><%= story.created_at.rfc2822 %></pubDate>
<comments><%= story.comments_url %></comments>
<description>
<%= raw coder.encode(story.markeddown_description, :decimal) %>
<% if story.url.present? %>
<%= raw coder.encode("<p>" +
link_to("Comments", story.comments_url) + "</p>", :decimal) %>
<% end %>
</description>
<% story.taggings.each do |tagging| %>
<category><%= tagging.tag.tag %></category>
<% end %>
</item>
<% end %>
</channel>
</rss>