google plus doesn't show meta information snippet from xhtml documents

I have been fighting with this for some time now, but I cannot figure out even a why it doesn't work. Take this simple XHTML test source:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>foobar</title>
        <meta name="description" content="baz" />
    </head>
    <body vocab="http://schema.org/" typeof="Article">
        <h1 property="headline">Some title</h1>
        <p property="description">some arbitrary text</p>
        <p>and even more of it</p>
    </body>
</html>

(for testing with google plus, this is also temporarily available here, and here you can find the plain html version)

If you paste a link to the XHTML version to g+, you'll find that it's unable to parse it at all. It will just show the link. The HTML version however seems to be parsed. Both parse well in the rich snippet tester from google. Even more, we have evidence indicating that our XHTML websites rich snippets are used in googles search.

The content type is announced correctly as application/xhtml+xml for the xhtml version, and I cannot figure out any other problem. I already tried to leave out the xml-declaration and use a XHTML 1.1 strict doctype, without any success.

So my question(s):

  • Why doesn't g+ show a snippet at all for this file in XHTML version, even though facebook does?
  • Can this be corrected somehow, without dropping XHTML, and if so, how?

  • I guess the parser g+ uses might not support XHTML, and possibly bails out if it can't handle the application/xhtml+xml MIME media type. Last time I heard the g+ and Google Rich Snippet testing tool were not using the same toolchain, so it's quite likely that something that works in the Rich Snippet testing tool might not work elsewhere, though it's a good sign if it works in the testing tool. I would think that in the future Google would align all their products with the capabilities of the rich snippet testing tool.

    Do you have any specific reason for using XHTML as opposed to HTML or HTML5 served as text/html?


    The microdata from your example doesn't appear to be in the expected format. You can generate the necessary microdata at: https://developers.google.com/+/plugins/snippet/

    Notice the missing itemprop, itemscope and similar attributes:

    <body itemscope itemtype="http://schema.org/Product">
      <h1 itemprop="name">Shiny Trinket</h1>
      <img itemprop="image" src="{image-url}" />
      <p itemprop="description">Shiny trinkets are shiny.</p>
    </body>
    
    链接地址: http://www.djcxy.com/p/88780.html

    上一篇: 为什么XHTML在脚本和样式标签中有PCDATA?

    下一篇: 谷歌加不会显示来自xhtml文档的元信息片段