簡體   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