如何创建一个简单的共享 linkedIn 链接?

问题描述 投票:0回答:8
javascript jquery linkedin
8个回答
20
投票

我认为问题是你没有按照 linkedin 要求的方式去做。您应该始终首先参考 API 文档。例如下面的 linkedin 描述了如何为您的站点生成共享插件。


6
投票

我使用这个非常简单的分享器:

<a href="https://www.linkedin.com/sharing/share-offsite/?url=your-url-here.com"target="_blank" title="Share on LinkedIn">
Share on LinkedIn
</a>

这是它的样子: Example of using simple LinkedIn sharer in Google Chrome


5
投票

您可以将 onclick url linkedin 'share?url=' 更改为 'shareArticle?mini=true&',我认为这很有帮助。

<a class="btn btn-default icon" href="javascript:void(0)" onclick="window.open( 'http://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink(); ?>', 'sharer', 'toolbar=0, status=0, width=626, height=436');return false;" title="Linkedin"><span class="character">j</span></a>

0
投票

你最好使用linkeidn脚本,或者看看他到底生成了什么

<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-url="<?php the_permalink(); ?>" data-counter="top"></script>

来源:linkedin developer


0
投票

这个脚本要加在最上面

<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang:en_US</script>

如果您想在弹出窗口中使用 linkedin 按钮,则必须在 html 中插入以下脚本。

<script type="IN/Share" data-url="http://linkedin.com">
            </script>

0
投票

第 1 步 - 获取正确的 URL

使用这种 URL 格式...

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

来源:MSD官方领英分享文档

第 2 步 - 处理标题、描述、图像等

在 HTML 的

og:
块中设置您的
<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' />

来源:LinkedIn 分享文档:使您的网站可在 LinkedIn 上分享

第 3 步 - 验证一切正常

使用 LinkedIn Post Inspector。在此处插入您的 URL (

example.com
),而不是您要与之共享的 URL (
linkedin.com?url=example.com
)。


0
投票

我在我的博文中使用这种风格

<a style="text-decoration:none;color: #0095ff;display: flex; flex-wrap: nowrap; align-content: center; justify-content: flex-start; align-items: flex-end; background-color: #f3f3f3; border: 4px solid #ededed; width: fit-content; padding: 2px; border-radius: 10px;" href="https://www.linkedin.com/sharing/share-offsite/?url=https://www.muratatasoy.com.tr/2023/04/tum-resimleri-powerpoint-slaytlarna.html" target="_blank" title="Share on LinkedIn">
Linked<svg height="24px" preserveaspectratio="xMinYMin meet" viewbox="0 0 24 24" width="24px" x="0" y="0"><g style="fill: currentcolor;"><rect height="24" style="fill: none;" width="24" x="-0.003"></rect><path d="M20,2h-16c-1.1,0-2,0.9-2,2v16c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2V4C22,2.9,21.1,2,20,2zM8,19h-3v-9h3V19zM6.5,8.8C5.5,8.8,4.7,8,4.7,7s0.8-1.8,1.8-1.8S8.3,6,8.3,7S7.5,8.8,6.5,8.8zM19,19h-3v-4c0-1.4-0.6-2-1.5-2c-1.1,0-1.5,0.8-1.5,2.2V19h-3v-9h2.9v1.1c0.5-0.7,1.4-1.3,2.6-1.3c2.3,0,3.5,1.1,3.5,3.7V19z"></path></g></svg></a>


-1
投票

我让它像这样工作(非常简单):

 <a target="_blank" title="Share on LinkedIn"
     href="http://www.linkedin.com/shareArticle?mini=true&url={{your-content-here.com}}">
 </a>

这将打开一个新标签(至少在 Chrome 中),看起来像这样:

在我的例子中,是指向 Chrome Webstorm 项目 url 的链接。因为我想在各种社交媒体网站上分享我的 Chrome 扩展应用程序。

© www.soinside.com 2019 - 2024. All rights reserved.