html - 在 Open Graph 标记中,没有位置 (href) 的 'og:locale:alternate' 有什么用?

标签 html markup facebook-opengraph

Facebook 的开放图谱协议(protocol)标记 allows for defining当前网页的语言环境,以及它也可用的任何替代语言环境,使用如下标记:

<meta property="og:locale" content="en_GB">
<meta property="og:locale:alternate" content="fr_FR">
<meta property="og:locale:alternate" content="es_ES">

可以很容易地推断出当前页面的固定链接(从 URL、Canonical URL 元标记或 og:url)。

但是包含 og:locale:alternate 而没有它们各自的 URL 有什么意义呢?它到底有什么用?

最佳答案

在官方 Facebook 开发者博客上标题为“Internationalizing Open Graph Apps”的文章中明确指出:

Translating Objects

In order to translate Open Graph objects, two things must happen. The developer must specify which locales are supported by the object through Open Graph meta tags, and the app must return the correct strings in the requested locale. For example, if the object can be translated into French and Spanish, the markup that describes this would look like the following:

<html>
<head>
    <meta property="og:locale:alternate" content="fr_FR" />
    <meta property="og:locale:alternate" content="es_ES" />
    ...
</head>
    ...
</html>

When Facebook needs to render an object in one of the specified locales, we will make a request to the object URL with the fb_locale URL parameter set, e.g. &fb_locale=es_ES. The app should then return the object markup in that specified locale. For more details on translating Open Graph objects, please look at the Open Graph I18N doc.

You can debug issues with translating objects by adding a fb_locale parameter, e.g. fb_locale=es_ES, to the Debugger and entering your object URL. If you change or add locales for a particular object, you can make Facebook re-scrape your object to pick up the changes by adding a scrape=true as described in the Objects section in the I18N documentation.

关于html - 在 Open Graph 标记中,没有位置 (href) 的 'og:locale:alternate' 有什么用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20827882/

相关文章:

javascript - 如何验证 HTML 表单?

document - 搜索 VMS 文档工具(VAX 文档?)

html - 当 "viewing source"时,一些网站有整洁的标记,一些网站没有。为什么? (附图)

seo - 将我的主页链接粘贴到 FB 墙上不显示 OpenGraph 摘录,存在 OG 元标记

asp.net - Facebook 评论审核困难

facebook - 使用提要对话框控制发布到 Facebook 的 swf 的大小

JavaScript 样式类型

html - 如何使 flex 元素以固定宽度包裹

Javascript 函数未被识别 : Uncaught ReferenceError: change is not defined

markup - ReStructuredText 编号的标题