首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >拼音和RSS2源不显示图像

拼音和RSS2源不显示图像
EN

Stack Overflow用户
提问于 2010-06-18 22:37:37
回答 1查看 731关注 0票数 0

我试图创建一个简单的RSS2,稍后我可以将其传递给FeedBurner,但是根本不能让RSS2 Feed显示图像。

另外,从我所读到的拥有xml.instruct!在顶部可能会导致IE抱怨它不是有效的提要。这是真的吗?

我的代码看起来像这样

代码语言:javascript
复制
xml.instruct!

xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do
 xml.channel do

   xml.title           "Store"
   xml.link            url_for :only_path => false, :controller => 'products'
   xml.description     "Store"
   xml.pubDate         @products.first.updated_at.rfc822 if @products.any?

   @products.each do |product|
     xml.item do
       xml.title       product.name
       xml.pubDate     (product.updated_at.rfc822)
       xml.image do
         xml.url       domain_host + product.product_image.url(:small)
         xml.title     "Store"
         xml.link      url_for :only_path => false, :controller => 'products'
       end
       xml.link        url_for :only_path => false, :controller => 'products', :action => 'show', :id => product.permalink
       xml.description product.fine_print
       xml.guid        url_for :only_path => false, :controller => 'products', :action => 'show', :id => product.permalink
     end
   end
 end

结束

已更新-描述中包含和不包含图像标记的代码片段

描述中没有image_tag -来自火狐

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Test Me</title>
    <link>http://localhost:3000/products</link>
    <description>Test Me</description>
    <pubDate>Mon, 21 Jun 2010 14:51:11 +0000</pubDate>
    <item>
      <title>Cylinder</title>
      <pubDate>Mon, 21 Jun 2010 14:51:11 +0000</pubDate>
      <image>
        <url>http://localhost:3000/assets/products/1/small/product_1.jpg</url>
        <title>Test Me</title>
        <link>http://localhost:3000/products</link>
      </image>
      <link>http://localhost:3000/products/1</link>
      <description>&lt;p&gt;&lt;h2&gt;Cylinder 2467.d&lt;/h2&gt;
This cylinder was designed for ruggedness and high performance&lt;/p&gt;</description>
      <guid>http://localhost:3000/products/1</guid>
    </item>
  </channel>

</rss>

描述中包含image_tag -来自火狐

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Test Me</title>
    <link>http://localhost:3000/products</link>
    <description>Test Me</description>
    <pubDate>Mon, 21 Jun 2010 14:46:54 +0000</pubDate>
    <item>
      <title>Cylinder</title>
      <pubDate>Mon, 21 Jun 2010 14:46:54 +0000</pubDate>
      <image>
        <url>http://localhost:3000/assets/products/1/small/product_1.jpg</url>
        <title>Test Me</title>
        <link>http://localhost:3000/products</link>
      </image>
      <link>http://localhost:3000/products/1</link>
      <description>&lt;img alt="Product_1" src="/assets/products/1/small/product_1.jpg?1276967922" /&gt;&amp;lt;p&amp;gt;&amp;lt;h2&amp;gt;Cylinder 2467.d&amp;lt;/h2&amp;gt;
This cylinder was designed for ruggedness and high performance&amp;lt;/p&amp;gt;</description>
      <guid>http://localhost:3000/products/1</guid>
    </item>
  </channel>

</rss>
EN

回答 1

Stack Overflow用户

发布于 2010-06-18 22:44:01

您的图像路径是相对的还是包含资源的完整URI?仔细检查你的脚本生成的这类东西的源代码。谷歌阅读器将尝试纠正这一点,但并不是每个RSS工具都会做同样的事情。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3070520

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档