简体   繁体   中英

Atom feed and rss reader

I'm trying to add a Atom feed for a page, but it just keeps spinning and adds all the items if only one new was added. What am i doing wrong?

http://legionaere.de/posts.atom?team_slug=1_team

在此输入图像描述

I'm using the default atom_feed helper from rails3

I think you need to add the pubDate entry similar to the published:

And also the format of the dates.

for example:

atom_feed do |feed|
  feed.title("Posts")
  feed.pubDate(CGI.rfc1123_date(@posts.first.created_at))
  feed.published(CGI.rfc1123_date(@posts.first.created_at))
  feed.updated(CGI.rfc1123_date(@posts.first.created_at))

  @posts.each do |post|
    feed.entry(:url => post_path(post)) do |entry|
      entry.title(post.title)
      entry.pubDate(CGI.rfc1123_date(post.created_at))
      entry.published(CGI.rfc1123_date(post.created_at))
      entry.updated(CGI.rfc1123_date(post.created_at))
    end
  end
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM