HTML5和RDFa支持 [英] HTML5 and RDFa support

查看:186
本文介绍了HTML5和RDFa支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我即将向现有的HTML5 Web应用程序介绍Open Graph协议,我想在不引入任何不必要的问题的情况下包含必要的RDFa数据。

I'm about to introduce the Open Graph protocol to an existing HTML5 Web application and I'd like to include the necessary RDFa data without introducing any unnecessary crud.

我查看了 HTML + RDFa 1.1 草案并将其与 Facebook的Open Graph协议文档,我只需要在<$上设置 lang 属性c $ c> html 元素及其HTML5准备就绪:

I've looked at the HTML+RDFa 1.1 draft and comparing it with Facebook's Open Graph protocol documentation, I just need to set the lang attribute on the html element and it's HTML5 ready:

<html lang="en">
<head xmlns:og="http://opengraphprotocol.org/schema/">
    <title>The Rock (1996)</title>
    <meta property="og:title" content="The Rock"/>
    <meta property="og:type" content="movie"/>
    ...

最初,我对HTML5中的RDFa支持感到困惑,因为有这么多来源声称不能以有效的方式完成,直到我最终登陆草案。我不是关于手头问题的专家,所以如果有人可以看看这个并且评论草案在今天的浏览器中所享有的支持,我会很感激。

Initially, I grew confused about RDFa support in HTML5 with so many sources claiming it cannot be done in a valid manner, until I finally landed on the draft. I'm no expert on the matters at hand, so I'd appreciate if someone could take a look at this and also comment about the support the draft enjoys in today's browsers.

推荐答案

W3C验证器呻吟大约每一个

The W3C validator moans about every

<meta property="whatever" content...

要求该物业

<meta name="whatever ...



<相反,对吗?如果facebook是你最关心的,我很乐意告诉它,它容忍后一种形式,所以就去吧:

instead, right? If facebook is, what you mostly care about, I am happy to tell, it tolerates the latter form, so just go for it:

<meta name="og:title" content="My nice picture"/>
<meta name="og:type" content="article"/>
<meta name="og:url" content="http://foobar123.com/test/simple.php"/>

使用FB测试时:小心,FB缓存页面解析(全局,facebook端,硬重载无效)所以mak每当你改变一些东西以测试它的发布时,一定要在网址中添加一个唯一的(但没有意义的)路径信息或GET参数:

When testing with FB: Beware, that FB caches page parsings (globally, facebook-side, hard reload won't help) so make sure to add a 'unique' (but pointless) path-info or GET Parameter to the url everytime you change something to test facebook-posting of it:

mysite.com/test.php/bogusParam1
mysite.com/test.php/bogusParam2
mysite.com/test.php/bogusParam3
...
mysite.com/test.php?foo=hello
mysite.com/test.php?foo=howdy
mysite.com/test.php?foo=aloha

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

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