journalduhacker/app/views/home/rss.erb
joshua stein 088084965c rss: only hide comments link when no url
stories with a url but also a description were previously not
getting comments link shown
2012-11-21 22:15:00 -06:00

32 lines
1.1 KiB
Plaintext

<?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 + (@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? %>
<p>
<%= raw link_to("Comments", story.comments_url) %>
</p>
<% end %>
</description>
<% story.taggings.each do |tagging| %>
<category><%= tagging.tag.tag %></category>
<% end %>
</item>
<% end %>
</channel>
</rss>