Facebook 开放图标签不适用于“私人”地点
我正在为客户创建一个“私人”销售网站。要查看网站内容,用户必须注册并登录。我们仍然希望使用 Facebook 来分享个人产品。不幸的是,如果我有产品的具体详细信息,当我共享链接时,我得到的只是默认的开放图标签。
我有什么选择?无论我是在网站内共享产品还是通过 Facebook 发布产品,都会发生这种情况。我正在使用 OpenGraph 标签(而不是 linter),我希望它能解决这个问题。
预先感谢您的帮助!
I'm creating a "private" sale site for a client. To view the site contents, users have to register and login. We'd still like to use Facebook for sharing individual products. Unfortunately, if I have specific details for a product, when I share the link, all I get is the default open graph tags.
What are my options? This is occurring whether I am sharing a product from within the site or posting it via Facebook. I'm using the OpenGraph tags (as opposed to the linter), which I was hoping would solve this issue.
Thanks in advance for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能需要做的是修改您的页面,以便它们为 Facebook 的爬虫呈现专用视图,并设置 OpenGraph 标签并删除所有识别信息。您可以查找他们的爬虫的用户代理(我认为是 facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)),然后根据该代理显示专用视图。
请注意,这意味着任何使用该标头集抓取您网站的人都将能够看到与您向 Facebook 抓取工具显示的内容相同的内容,但考虑到它在 Facebook 上进行,您可能并不关心。也不确定 Facebook 对这种转换的政策是什么:可能被解释为伪造内容。
What you'll probably have to do is modify your pages so they render a dedicated view for Facebook's crawlers, with the OpenGraph tags set and all identifying information stripped out. You could look for their crawler's user agent (which I believe is
facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)
) and then based on that show the dedicated view.Note that this will mean that anyone who crawls your site with that header set will be able to see the same content that you show the Facebook crawler, but given that its going on Facebook you probably don't care. Also not sure what the policy from Facebook is on that kind of switch: might be construed as faking content.
您还可以创建专用脚本来提供共享信息。 此处讨论了此技术。
You could also create a dedicated script to serving the share information. This technique is discussed here.