我有一个应用程序,可以让人们将内容发布到他们的LinkedIn页面。我想要做的是创建一个按钮,我可以将其包含在一封电子邮件中,点击该按钮后,会将用户发送到LinkedIn并打开该框以共享帖子。我想知道的是如何生成这个网址。结构是什么样的?到目前为止,我发现的所有信息都是关于如何在LinkedIn上分享到另一个网站的链接,而不是如何将用户引导到共享信箱。
答案 0 :(得分:54)
第一步,让我们看一下正确的URL ...
2010年:
https://www.linkedin.com/cws/share?url={url}
2015年:
https://www.linkedin.com/shareArticle?url={url}&title={title}&summary={text}&source={provider}
2020:
https://www.linkedin.com/sharing/share-offsite/?url={url}
Official Microsoft LinkedIn Share API Documentation 。当然,不要相信我们!以上任何一种URL格式都将重定向到2020 URL格式。
第二步,如何使用summary
,title
等? 使用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' />
来源:LinkedIn Share Documentation: Making Your Website Shareable on LinkedIn
第三步,现在想检查一下您是否做对了所有事情? 这很简单!输入您要共享的网址(即example.com
,而不是linkedin.com?share=example.com
),并将其输入到 LinkedIn Post Inspector 中。从og:
标记到oEmbed
数据,您将被告知确定您如何在LinkedIn上共享网页的所有内容。
这里是online demo,其中包含指向20多个服务的共享链接。查看源代码,您可以直接看到Linkedin的共享链接的工作原理!
第四步,为什么og:description
标签不起作用?
我有一个more detailed answer elsewhere on the og:description
tag not displaying in the LinkedIn preview.
如果您对定期维护的GitHub项目感兴趣,可以跟踪该项目,而不必这样做,请查看!我是贡献者! Social Share URLs
答案 1 :(得分:23)
来自LinkedIn developer docs(&#34;自定义网址&#34;标签):
https://www.linkedin.com/shareArticle?mini=true&url=http://developer.linkedin.com&title=LinkedIn%20Developer%20Network&summary=My%20favorite%20developer%20program&source=LinkedIn
答案 2 :(得分:1)
在使用 LinkedIn 共享时遇到问题并找到了解决方法:
与非 SSL (http) 地址共享的站点将显示错误:“出现问题 - 再试一次”
https://www.linkedin.com/sharing/share-offsite/?url=http://example.com
如何解决“出现问题”共享链接错误:
修改开头的 {url} - 用 https 替换 http:
https://www.linkedin.com/sharing/share-offsite/?url=https://example.com
访问链接以生成 LinkedIn 的缩略图和页面描述。
非 SSL (http) 和 SSL (https) 的共享链接地址现在都可以正常工作了。
编辑:将 //example.com 替换为您的网站