首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将产品详细信息从网站分享到Facebook和LinkedIn

如何将产品详细信息从网站分享到Facebook和LinkedIn
EN

Stack Overflow用户
提问于 2020-08-20 01:14:41
回答 1查看 385关注 0票数 0

我需要分享我的产品细节(名称,图像和描述)从我的网站到脸书和LinkedIn,但没有显示在FB中的任何东西,但网址是通过所有参数。我的代码如下

代码语言:javascript
复制
@foreach ($data['products'] as $list)
<img src="{{ $list['oneimage'] }}" alt="">
@endforeach
@foreach ($data['products'] as $list)
{{ $list['name'] }}
{{ $list['description'] }}
<a href="http://www.facebook.com/sharer.php?u={{url('/Shop/'.$data['webname'].'/products/'.$list['id'].'/details')}}&summary={{$data['webname']}}&og:image={{$list['oneimage']}}" target="_blank">
    </a>
<a href="https://www.linkedin.com/shareArticle?mini=true&url={{url('/Shop/'.$data['webname'].'/products/'.$list['id'].'/details')}}&title={{$data['webname']}}&summary={{$data['webname']}}" target="_blank"></a>
EN

回答 1

Stack Overflow用户

发布于 2020-10-09 00:41:36

您的URL格式正确...

代码语言:javascript
复制
https://www.linkedin.com/sharing/share-offsite/?url={url}

来源:。

因此,您现在需要设置的就是og:标记,以指示标题、摘要、图像等内容。这些标记将被插入到您的HTML...的<head>块中

  • <meta property='og:title' content='Title of the article'/>
  • <meta property='og:image' content='//media.example.com/1234567.jpg'/>
  • <meta property='og:description' content='Description that will show in the preview'/>
  • <meta property='og:url' content='//www.example.com/URL of the article' />

来源:

如果您想检查是否一切都做对了,那么可以查看。从普通的老式<title>标签到oEmbedog:标签的所有内容都将被检查和测试,并将结果显示给用户。下面是我使用上述代码组装的一个小演示站点:EarthFluent.com

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63491898

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档