正如 Marcin 所说,在将一个 URL 作为参数传递给另一个 URL 的 GET 参数时(不仅在 LinkedIn URL,而且在所有 URL 中),您必须执行 URL encoding。但实际上还有一点需要解决!
您似乎使用的是旧格式的 LinkedIn 共享 API。自从被 Microsoft 收购后,LinkedIn 的大部分文档(尤其是最新的资料)都可以在 Microsoft 开发人员网站上找到。看看:Official Microsoft LinkedIn Sharing Documentation。所以,你的 URL 应该看起来像......
https://www.linkedin.com/sharing/share-offsite/?url={url}
您还尝试发送title 和其他参数,但唯一支持的参数是url。
不过,您可能想分享标题等信息,对吧?在这种情况下,请在 HTML 页面的 <head> 块中设置 og: 标记,如下所示...
<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 Documentation: Making Your Website Shareable on LinkedIn。
og: 标签确实是一种良好的标准做法,为什么不呢?如果您想知道您是否正确设置了所有内容,LinkedIn 也为您提供了帮助:
LinkedIn Post Inspector :检查您要共享的 URL,确保所有配置正确,带有正确的 og: 标签等。输入您要共享的 URL,即example.com/YourSite/ThisPageIsWhatYouWantToBeSharedOnLinkedIn.
希望这会有所帮助!