【问题标题】:LinkedIn stripping parameters from the share button urlLinkedIn 从共享按钮 url 中剥离参数
【发布时间】:2020-02-04 17:18:13
【问题描述】:

我正在向我的网站添加一个 LinkedIn 分享按钮。需要共享的 URL 包含一个参数,但 LinkedIn 正在从 URL 中剥离参数。有什么办法可以解决这个问题?

我尝试过使用自定义共享 URL,例如

http://www.linkedin.com/shareArticle?mini=true&url=https://stackoverflow.com/questions/10713542/how-to-make-custom-linkedin-share-button/10737122&title=How%20to%20make%20custom%20linkedin%20share%20button&summary=some%20summary%20if%20you%20want&source=stackoverflow.com

我也尝试过使用他们的分享插件,例如

<script src="https://platform.linkedin.com/in.js" type="text/javascript">lang: en_US</script>
<script type="IN/Share" data-url="https://website.com/?par=1"></script>

这两个选项都不适合我。 URL 只是默认为根域。

【问题讨论】:

  • 我尝试直接访问您的网址,它似乎可以正常工作。
  • 什么网址?第一个例子中的那个?这只是显示该共享选项格式的示例。这不是我要分享的实际网址。
  • 如果这个工作正常而不是你的,那可能是因为你传递了无效的参数。
  • 请重新阅读我的帖子。我遇到了正在共享的 url 中的参数问题……而不是共享 url 参数。
  • 这能回答你的问题吗? LinkedIn Share Post URL

标签: javascript linkedin linkedin-api


【解决方案1】:

LinkedIn 不再支持这些参数。

2010:

https://www.linkedin.com/cws/share?url={url}

2016 年:

https://www.linkedin.com/shareArticle?url={url}&title={title}&summary={text}&source={provider}

2020:

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

不幸的是,我们只能使用url 参数来生存。

来源:Official Microsoft LinkedIn Share API Docs

但是,如果你想在分享页面上显示一些站点信息的预览,在用户点击分享之前,你可以使用og:标签...

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

来源:LinkedIn Developer Docs: Making Your Website Shareable on LinkedIn

完成后:使用LinkedIn Post Inspector 进行测试。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-06
    相关资源
    最近更新 更多