【发布时间】:2015-04-17 17:47:38
【问题描述】:
我正在尝试使用http://schema.org/Code 在博客上标记源代码。标记源代码的正确方法是什么?
我正在使用谷歌工具测试它:http://www.google.com/webmasters/tools/richsnippets
<div itemscope itemtype="http://schema.org/Code" >
some code
</div>
我认为这样的事情可能会奏效。但是没有注册任何东西。
我看到它继承自 creativeWork,所以也许我应该使用这些属性之一来包含源代码内容,但我不确定。例如:
<div itemscope itemtype="http://schema.org/Code" >
<meta itemprop="programmingLanguage" content="Java" />
<span itemprop="exampleOfWork">import java.util.*;</span>
</div>
但是代码没有注册。它说“exampleofwork 不是架构的一部分”,即使它应该被继承......
有人知道正确/首选的方法吗?
【问题讨论】:
-
请注意,Google 发布了一个新工具:developers.google.com/structured-data/testing-tool
-
谢谢!我会试试看。虽然它不幸地认为我想用日语看它,只是因为我在日本。即使页脚中的语言选择器显示“英语”。 :P 但这是谷歌的错。不是你的。从现在开始我会使用它,再次感谢!
-
您可以尝试附加参数
?hl=en(英文),即developers.google.com/structured-data/testing-tool/?hl=en
标签: seo schema.org microdata structured-data