我喜欢的 Facebook 插件 - 它在哪里获取有关标题/描述/照片的信息?

发布于 2025-01-01 09:16:25 字数 322 浏览 0 评论 0原文

当我在带有 facebook 插件的网站上输入“我喜欢”时,我会在 Facebook 上看到该页面的标题、描述、图像等等...

如果我尝试将插件放在我的网站上并做一个“我喜欢”,我只能看到主页上的标题,仅此而已!

我需要在哪个标签上插入图像路径、描述和自定义标题? 实际上,我的文档类型是:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

所以,不是 HTML5 页面。

When I do an "I Like" on a website with the facebook plugins, I see on Facebook there is the Title of that page, a description, an image, and so on...

If I try to put the plugins on my website and do an "I Like", I can only see title on of the main page, nothing more!

On which tag need I to insert the image path, description, and a custom title?
Actually, my doctype is :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

so, not an HTML5 page.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天生の放荡 2025-01-08 09:16:25

您应该阅读开放图协议
本质上,您需要在页面上嵌入一些og:tags,以便 Facebook 知道在预览类似操作时要显示哪些信息。

这些标签应放置在您的 head 标签内,它们看起来像这样:

<meta property="fb:app_id" content="YOUR_APP_ID" /> 
<meta property="og:type" content="YOUR_NAMESPACE:recipe" /> 
<meta property="og:title" content="YOUR_PAGE_TITLE" /> 
<meta property="og:image" content="YOUR_IMAGE_URL" /> 
<meta property="og:description" content="YOUR_DESCRIPTION_TEXT" /> 
<meta property="og:url" content="YOUR_URL"> 

不要忘记用您自己的值替换那里的值。
如果您在选择使用哪些标签或使用哪些值时遇到困难 - 您应该查看 Facebook 为我们提供的这个很棒的工具:
Facebook 的 URL 调试器

该工具将向您准确显示 Facebook 如何查看您的网址,并且还会提醒您 og:tags 可能出现的任何错误。


Be aware of the caching that Facebook does of your tags :
Taken from the Open Graph Documentation

编辑元标记

您可以通过更新页面的属性来更新页面的属性
标签。请注意,og:title 和 og:type 只能编辑
最初 - 当您的页面收到 50 个赞后,标题就会固定,
当你的页面收到 10,000 个赞后,类型就固定了。
这些属性是固定的,以避免让喜欢的用户感到惊讶
页面已经。在这些限制之后更改标题或类型标签
已到达 不执行任何操作,您的页面保留原始标题并且
类型。

为了使更改反映在 Facebook 上,您必须强制您的页面
被刮掉。当页面管理员点击时,页面会被抓取
点赞按钮或在 Facebook URL 中输入 URL 时
短绒。

You should readup on the Open Graph Protocol.
Essentially you'll need to embed some og:tags onto your page so that Facebook can know what information to display for the preview of the like action.

The tags should be placed within your head tag and they look something like this :

<meta property="fb:app_id" content="YOUR_APP_ID" /> 
<meta property="og:type" content="YOUR_NAMESPACE:recipe" /> 
<meta property="og:title" content="YOUR_PAGE_TITLE" /> 
<meta property="og:image" content="YOUR_IMAGE_URL" /> 
<meta property="og:description" content="YOUR_DESCRIPTION_TEXT" /> 
<meta property="og:url" content="YOUR_URL"> 

Don't forget to substitute the values there for your own values.
If you are having difficulties in choosing what tags to use or what values to use - you should check out this great tool that Facebook has provided us :
Facebook's URL Debugger

This tool will show you exactly how Facebook views your URL and it will also alert you to any errors that you might have with your og:tags.


Be aware of the caching that Facebook does of your tags :
Taken from the Open Graph Documentation

Editing Meta Tags

You can update the attributes of your page by updating your page's
tags. Note that og:title and og:type are only editable
initially - after your page receives 50 likes the title becomes fixed,
and after your page receives 10,000 likes the type becomes fixed.
These properties are fixed to avoid surprising users who have liked
the page already. Changing the title or type tags after these limits
are reached does nothing, your page retains the original title and
type.

For the changes to be reflected on Facebook, you must force your page
to be scraped. The page is scraped when an admin for the page clicks
the Like button or when the URL is entered into the Facebook URL
Linter.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文