将Microdata实施到非HTML5页面 [英] Implement Microdata to a non HTML5 page

查看:159
本文介绍了将Microdata实施到非HTML5页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网页上使用Microdata结构(使用Schema.org)。我的网页尚未使用HTML5。



如何实现 itemscope itemtype 标签?当我添加这些时,我得到错误:


itemscope 不是一个有效的属性元素 dive



解决方案

Microdata ,其中包括itemscope和itemtype属性是HTML5工作的一部分,所以没有标准doctype可用于使用具有早期doctype的微数据。您有几个选项,但没有一个特别适合。


  1. 将您的网页更改为HTML5。这可能是最好的前进方向。 忽略验证错误。验证器只是一个工具来帮助你。微数据的消费者不太可能关心您使用的文档类型。

  2. 有一个HTML4.01和RDFa的文档类型<!DOCTYPE HTML PUBLIC - // W3C // DTD HTML 4.01 + RDFa 1.1 // ENhttp://www.w3.org/ MarkUp / DTD / html401-rdfa11-1.dtd> 和W3C HTML验证程序可以识别这一点。 写下你自己的文档类型定义为HTML4.01 +微数据并验证您的页面。或谷歌,看看是否有其他人已经写了非官方的。


I want to implement the Microdata structure to my web page (using Schema.org). My web page is not using HTML5 yet.

How do I implement the itemscope and itemtype tags? When I add these I get the error:

itemscope is not a valid attribute of element dive

解决方案

Microdata, which includes the itemscope and itemtype attributes is part of the HTML5 work so there's no standard doctype available for using microdata with earlier doctypes. You have a few options, but none are particularly palatable.

  1. Change your page to HTML5. This is probably the best way forward.

  2. Ignore the validation errors. The validator is only a tool to help you. The consumers of the microdata are unlikely to care what doctype you are using.

  3. Instead of using microdata, you could use RDFa with your schema.org vocabulary. There is a doctype for HTML4.01 and RDFa <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/html401-rdfa11-1.dtd"> and the W3C HTML validator recognises this.

  4. Write your own document type definition for HTML4.01 + microdata and validate your page against that. Or Google to see if someone else has written an unofficial one already.

这篇关于将Microdata实施到非HTML5页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆