开发者

How to tell feed readers the article is not new when its url has changed?

I have a Rails blog using friendly_id for creating custom urls. The blog has an RSS feed.

When I edit the title of a blog post the url is changed accordingly. Then in Google Reader I receive a new feed with the changed title.

Is there a way to tell feed readers that the feed is not new?

My index.rss.builder looks like:

xml.instruct! :xml, :version => "1.0"  
xml.rss :version => "2.0" do  
  xml.channel do  
    xml.title 'My blog title'  
    xml.link posts_url(开发者_Python百科:format => :rss)

    for post in @posts  
      xml.item do  
        xml.title post.title  
        xml.description textilize(post.body)
        xml.pubDate post.created_at.to_s(:rfc822)  
        xml.link post_url(post)   
        xml.guid post_url(post)   
      end  
    end  
  end  
end


The guid element is used by feed readers to determine if the post is new or not.

Instead of the URL, you should perhaps use the post ID for the GUID, as this will not change when you edit the post. You will need to tell the readers that the GUID is no longer a permalink, and then they will use the link attribute instead.

xml.guid "my_blog_title_post_#{post.id}", :isPermaLink => false
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜