简体   繁体   English

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

[英]How to share Product Details from website to Facebook and LinkedIn

I need to share my product details (Name, Image, and Description) from my website to Facebook and LinkedIn but not showing anything in FB but the URL is passing with all parameters.我需要从我的网站向 Facebook 和 LinkedIn 分享我的产品详细信息(名称、图片和描述),但在 FB 中没有显示任何内容,但 URL 正在传递所有参数。 My Code as Follows我的代码如下

@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>

Your URL format is correct...您的 URL 格式正确...

https://www.linkedin.com/sharing/share-offsite/?url={url}

Source: Official Microsoft LinkedIn Share API Documentation .来源: 微软官方LinkedIn分享API文档

So, all you need to set now is the og: tags to indicate things like title, summary, image, etc.. These tags will be inserted into the <head> block of your HTML...因此,您现在只需要设置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' />

Source: LinkedIn Share Documentation: Making Your Website Shareable on LinkedIn资料来源: LinkedIn 共享文档:让您的网站在 LinkedIn 上可共享

If you want to check and see if you did everything right, then look at the LinkedIn Post Inspector .如果您想检查一下您是否做对了所有事情,请查看LinkedIn Post Inspector Everything from plain old <title> tags to oEmbed and og: tags will be inspected and tested and the results given to the user shown.从普通的旧<title>标记到oEmbedog:标记的所有内容都将被检查和测试,并将结果显示给用户。 Here's a small little demo site I put together that uses the above code: EarthFluent.com .这是一个使用上述代码的小型演示站点: EarthFluent.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM