首页 > 解决方案 > 使用 React Native 在 LinkedIn 上分享帖子

问题描述

我有一个内置 react-native 的应用程序,我需要在 LinkedIn 上分享带有预定义内容的帖子。

我使用“react-native-share”在 LinkedIn 上共享内容,但它不起作用。我怎样才能做到这一点?

提前致谢。

标签: react-nativelinkedin

解决方案


LinkedIn 只支持传递给它的一个参数,那就是url参数。 它看起来像这样......

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

来源:LinkedIn 官方分享文档

以下参数将不起作用summarytitlesource等。除此之外的任何东西url

要分享到 LinkedIn,只需创建一个<a href>指向上述格式化 URL 的元素,并确保在您的{url}.

title但是,您可能希望summary根据已接受的答案进行分享。你不能使用GET-data 来做到这一点,你可以使用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 开发人员文档:让您的网站在 LinkedIn 上可共享

如果您不确定是否已正确按照 LinkedIn 文档创建共享 URL,您可以测试页面的 URL 以查看在此处共享时的外观:LinkedIn Post Inspector


推荐阅读