当我在facebook或google plus上共享页面时,如何自定义内容显示。标题,描述,图像等。当我现在在Facebook上共享我的页面时,它会添加一个特定的图像和标题。如果使用google plus,图像可以正确共享,但标题仍然不是我所需要的。
这是我目前使用它们的方式:

<a href="http://www.facebook.com/sharer.php?u=http://www.mywebsite.com" target="_blank"></a>

<!-- Google+ -->
<a href="https://plus.google.com/share?url=http://www.mywebsite.com" target="_blank"></a>


我知道如何根据自己的需要对其进行自定义,或者是否有可以支持我的软件包。另外,我是否需要在facebook或google plus上创建一个应用程序。我只是在使用分享按钮。

最佳答案

像这样的Facebook分享

<meta property="og:title" content="title here" />
<meta property="og:image" content="image url here" />
<meta property="og:type" content="website" />


首先使用https://developers.facebook.com/tools/debug/在facebook上调试页面
清除您网站上的Facebook缓存

您不必在Facebook上创建应用程序即可使用共享按钮,我认为与gplus相同,但我不确定。

或创建此页面作为要共享的目标网址

<php
    $title = 'title';
    $image = 'image';
?>
<meta property="og:title" content="{{$title}}" />
<meta property="og:image" content="{{$image}}" />
<meta property="og:type" content="website" />
<script>
    window.location = "http://www.url-to-real-shared-page";
</script>

08-04 11:40
查看更多