将元描述和开放图协议描述合并到一个标签中 [英] Combining the meta description and Open Graph Protocol description into one tag

查看:96
本文介绍了将元描述和开放图协议描述合并到一个标签中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以组合元描述和开放图协议描述...

Is it possible to combine the meta description and Open Graph Protocol description…

<meta name="description" content="My meta description copy." />
<meta property="og:description" content="My meta description copy." />

...一个包含相同的内容?

…into one when they contain the same content?

<meta name="description" property="og:description" content="My meta description copy." />


推荐答案

是的,你可以组合它们。要测试它,我下面简单的HTML页面,将其上传到服务器,然后通过Facebook的 URL Linter 。它没有报告与描述标签相关的警告(仅关于缺少的 og:image 标记),并正确阅读说明。

Yes, you can combine them. To test it, I made the simple HTML page below, uploaded it to a server, then ran the page through Facebook's URL Linter. It reported no warnings related to the description tag (only about the missing og:image tag) and correctly read the description.

<!doctype html>
<html>
    <head>
        <meta name="description" property="og:description" content="My meta description copy." />
        <meta property="og:title" content="Test page" />
        <meta property="og:type" content="article" />
        <meta property="og:url" content="http://example.com/ogtest.html" />
    </head>
    <body>
    Test
    </body>
</html>

请注意,如果 og:url 值与当前页面的URL不同,Facebook会查找该网址的描述,而不是当前页面的描述标签。

Note that, if the og:url value is different to the current page url, Facebook will look for a description on that url instead of the current one and ignore the current page's description tag.

它也可能感兴趣你知道,即使可以组合两个描述标签,Facebook也不会在自己的网站上这样做。

It might also interest you to know that, even though it's possible to combine the two description tags, Facebook doesn't do this on their own website.

这篇关于将元描述和开放图协议描述合并到一个标签中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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