本文介绍了带有自定义标题,描述和图像的facebook共享按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Facebook似乎以多种方式支持自定义标题,描述和缩略图.
It looks like that the Facebook support custom title, description, and thumbnail in several ways.
到目前为止,我已经找到了两种解决方案.
So far, I have found two solutions.
-
使用元标记
using meta tag
[meta name="title" content="title" /]
[meta name="description" content="description" /]
使用URL参数.
using URL parameters.
[a href='http://www.facebook.com/sharer.php?s=100&p[title]=WEB1CHANNEL&p[summary]=Web+Design+Company+in+Dubai.&p[url]=http://www.webchannel.ae&p[images][0]=http://qacode.com/test.jpg']asdfa[/a]
我真的很喜欢解决方案2,但是看起来不稳定.有时它起作用,有时却不起作用.总体而言,它仍然可以正常工作.
I really like solution #2, but it looks like it is not stable. Sometimes it works, sometimes it does not. Overall, it works anyway.
可以使用解决方案2吗?将来会面世吗?
Is it okay to use solution #2? Is it going to be available in the future?
推荐答案
- 使用 Open-Graph Meta标签让Facebook获取数据抓取页面时所需的内容.
- Facebook不会尊重您传递给
sharer.php
的参数,而是会尝试从页面获取信息. - 类似插件是一种解决方法,如果您真的没有充分的理由使用共享器...不要使用它!
- 对照 Facebook Debbuger 检查您的URL,以更好地测试您的链接.
- Use Open-Graph Meta Tags to let Facebook get the data you want when scraping the page.
- Facebook will not respect the parameters you pass to
sharer.php
instead it'll try to get the info from the page. - The Like plugin is the way to go and if you really don't have a good reason to use sharer...don't use it!
- Check your URL against the Facebook Debbuger to better test your links.
这篇关于带有自定义标题,描述和图像的facebook共享按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!