【发布时间】:2015-06-30 03:43:34
【问题描述】:
This StackOverflow 回答建议您应该使用 HTML 条目内容并使用标准的<img> 标记链接到您的图像。
<content type="html">
<![CDATA[
<a href="http://test.lvh.me:3000/listings/341-test-pics?locale=en">
<img alt="test_pic" src="http://test.lvh.me:3000/system/images/20/medium/test_pic.jpg?1343246102" />
</a>
]]>
</content>
我还发现了一个叫做 Yahoo 媒体扩展 here 的东西,它允许您添加自定义的附加元素。
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/">
<!-- ommitted -->
<entry>
<!-- ommitted -->
<media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="path_to_image.jpg" />
</entry>
</feed>
Google 似乎也有自己的类似扩展。见here。
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">
<!-- ommitted -->
<entry>
<!-- ommitted -->
<g:image_link>http://www.google.com/images/google_sm.gif</g:image_link>
</entry>
</feed>
我自己的直觉告诉我,我应该能够像这样添加指向图像的链接:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<!-- ommitted -->
<entry>
<!-- ommitted -->
<link rel="enclosure" type="image/png" length="1337"
href="http://example.org/image.png"/>
</entry>
</feed>
实现最大兼容性的正确方法是什么?
【问题讨论】:
-
我不敢相信像 Atom 1.0 这样的主要互联网基础设施已经 8 年了,文档却如此之少。甚至没有很多关于它的博客文章!!!
-
我写了一篇博文(在过去几年中我能找到的关于该主题的少数几篇文章之一)here。
标签: image feed yahoo-api atom-feed google-base