标签: google-base

将图像或缩略图添加到Atom 1.0条目

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>
Run Code Online (Sandbox Code Playgroud)

我还在这里找到了一个名为Yahoo media extensions的东西,它允许你添加自定义的附加元素.

<?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>
Run Code Online (Sandbox Code Playgroud)

谷歌似乎也有自己类似的扩展.看到这里.

<?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>
Run Code Online (Sandbox Code Playgroud)

我自己的直觉告诉我,我应该只需添加链接到图像,如下所示:

<?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>
Run Code Online (Sandbox Code Playgroud)

最大兼容性的正确方法是什么?

image feed google-base yahoo-api atom-feed

9
推荐指数
1
解决办法
2245
查看次数

标签 统计

atom-feed ×1

feed ×1

google-base ×1

image ×1

yahoo-api ×1