如何自定义Facebook的sharer.php [英] How do I customize Facebook's sharer.php

查看:111
本文介绍了如何自定义Facebook的sharer.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http:// www。 facebook.com/sharer/sharer.php?u=http%3A%2F%2Fwww.google.com

如何自定义文字和图片。

How can I customize the text and image. It looks like Facebook pulled the docs.

推荐答案

您正在谈论的是Facebook分享的预览图像和文字一条链接。 Facebook使用开放图表协议获取此数据。

What you are talking about is the preview image and text that Facebook extracts when you share a link. Facebook uses the Open Graph Protocol to get this data.

本质上,您需要做的就是将这些 og:meta 标签放在要共享的URL上。

Essentially, all you'll have to do is place these og:meta tags on the URL that you want to share -

<meta property="og:title" content="The Rock"/>
<meta property="og:type" content="movie"/>
<meta property="og:url" content="http://www.imdb.com/title/tt0117500/"/>
<meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/>
<meta property="og:site_name" content="IMDb"/>
<meta property="fb:admins" content="USER_ID"/>
<meta property="og:description"
      content="A group of U.S. Marines, under command of
               a renegade general, take over Alcatraz and
               threaten San Francisco Bay with biological
               weapons."/>

正如你所看到的那样,都有一个图像属性和一个描述。当您更改您的网页 og:meta 标签时,您可以使用 Facebook Debugger 。它会告诉你,如果你有任何错误(和如何解决他们!)

As you can see there are both an image property and a description. When you make changes to your pages og:meta tags, you can test these changes using the Facebook Debugger. It will tell you if you have made any mistakes (and how to fix them!)

这篇关于如何自定义Facebook的sharer.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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