繁体   English   中英

如何在atom rss feed中传递图像条目。 在轨道3.1

[英]How to pass image entry in atom rss feed. in rails 3.1

每次人们提供有关如何制作Atom rss模板的教程时,但是我的问题是我如何传递rss格式的图像。 例如我在rss中有此代码示例

atom_feed :language => 'en-US' do |feed|
  feed.title @title
  feed.updated @updated

  @news_items.each do |item|
    next if item.updated_at.blank?

    feed.entry( item ) do |entry|
      entry.url news_item_url(item)
      entry.title item.title
      entry.content item.content, :type => 'html'

      # the strftime is needed to work with Google Reader.
      entry.updated(item.updated_at.strftime("%Y-%m-%dT%H:%M:%SZ")) 

      entry.author do |author|
        author.name entry.author_name)
      end
    end
  end
end

我在哪里可以显示文章的图像以及如何做

Atom格式( http://www.atomenabled.org/developers/syndication/ )支持图标(正方形)和徽标(矩形)...因此在您的代码块中

entry.icon '/path/to/my/icon.png'
entry.logo '/path/to/my/logo.png'

编辑:为我服务,不检查某些代码。 这些元素是feed元素的可选元素,而不是entry 尝试:

feed.icon '/path/to/my/icon.png'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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