Open Graph 命名空间声明:带有 XMLNS 或头部前缀的 HTML? [英] Open Graph namespace declaration: HTML with XMLNS or head prefix?

查看:19
本文介绍了Open Graph 命名空间声明:带有 XMLNS 或头部前缀的 HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于如何最好地实现开放图谱命名空间,我看到了相互矛盾的信息.具体来说,Open Graph 网站使用了几种不同的方法,而 Facebook Open Graph 示例使用了其他方法.

I have seen conflicting information on how to best implement Open Graph namespaces. Specifically, the Open Graph website uses a few different methods, and the Facebook Open Graph examples use other methods.

Open Graph 网站示例(使用 HTML 前缀属性):

Open Graph website example (using HTML prefix attribute):

<html prefix="og: http://ogp.me/ns#">

Open Graph 网站源代码(使用 HTML XMLNS 属性):

Open Graph website source code (using HTML XMLNS attribute):

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#">

Facebook Open Graph 文档(使用 HEAD 前缀属性):

Facebook Open Graph documentation (using HEAD prefix attribute):

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">

Facebook Open Graph 文档 #2(使用 HTML XMLNS 属性):

Facebook Open Graph documentation #2 (using HTML XMLNS attribute):

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" 
      xmlns:fb="https://www.facebook.com/2008/fbml">

推荐的方法是什么,或者根本不重要?

What is the recommended method or does it not even matter?

推荐答案

它们都是等价的,都会起作用.

They are all equivalent and will all work.

使用前缀,因为它是新推荐的方式并且字符更少.

Use prefix as it is the new recommended way and is fewer characters.

我会将所有文档更新为前缀.

I'll get all our documentation updated to prefix.

这篇关于Open Graph 命名空间声明:带有 XMLNS 或头部前缀的 HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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