Ruby on rails Ruby和RSS2提要不显示图像
尝试创建一个简单的RSS2提要,我可以稍后将其传递给FeedBurner,但根本无法让RSS提要显示图像 另外,从我读到的xml.instruct!顶部可能会导致IE抱怨它不是有效的提要。这是真的吗 我的代码看起来像Ruby on rails Ruby和RSS2提要不显示图像,ruby-on-rails,ruby,feed,Ruby On Rails,Ruby,Feed,尝试创建一个简单的RSS2提要,我可以稍后将其传递给FeedBurner,但根本无法让RSS提要显示图像 另外,从我读到的xml.instruct!顶部可能会导致IE抱怨它不是有效的提要。这是真的吗 我的代码看起来像 xml.instruct! xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do xml.channel do xml.title
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
结束
更新-描述中包含和不包含图像标记的代码段
描述中没有图像标签-来自Firefox
<?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><p><h2>Cylinder 2467.d</h2>
This cylinder was designed for ruggedness and high performance</p></description>
<guid>http://localhost:3000/products/1</guid>
</item>
</channel>
</rss>
<?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><img alt="Product_1" src="/assets/products/1/small/product_1.jpg?1276967922" />&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>
考验我
http://localhost:3000/products
考验我
2010年6月21日星期一14:51:11+0000
圆柱
2010年6月21日星期一14:51:11+0000
http://localhost:3000/assets/products/1/small/product_1.jpg
考验我
http://localhost:3000/products
http://localhost:3000/products/1
ph2气缸2467.d/h2
该气缸设计为坚固耐用和高性能/p
http://localhost:3000/products/1
描述中带有图像_标记-来自Firefox
<?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><p><h2>Cylinder 2467.d</h2>
This cylinder was designed for ruggedness and high performance</p></description>
<guid>http://localhost:3000/products/1</guid>
</item>
</channel>
</rss>
<?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><img alt="Product_1" src="/assets/products/1/small/product_1.jpg?1276967922" />&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>
考验我
http://localhost:3000/products
考验我
2010年6月21日星期一14:46:54+0000
圆柱
2010年6月21日星期一14:46:54+0000
http://localhost:3000/assets/products/1/small/product_1.jpg
考验我
http://localhost:3000/products
http://localhost:3000/products/1
img alt=“Product_1”src=“/assets/products/1/small/Product_1.jpg?1276967922”/&;书信电报;宝洁;燃气轮机&;书信电报;h2&;燃气轮机;气缸2467.d&;lt/h2&;燃气轮机;
该气缸设计为坚固耐用、高性能&;lt/宝洁;燃气轮机;
http://localhost:3000/products/1
您的图像路径是相对的还是包含资源的完整URI?仔细检查脚本生成的源代码,以了解此类内容。Google reader会尝试纠正这一点,但不是每个RSS工具都会这样做。完整的url在那里,firefox和safari不会显示它,但当我查看源代码时,它会显示它。如果我尝试在描述中添加一个图像标记,它会显示图像,但是所有的html样式也会显示出来。i、 例如,- ,等。若你们能在某处粘贴一点提要,可能会有所帮助。。。