react-native - 使用 React Native 在 LinkedIn 上分享帖子
问题描述
我有一个内置 react-native 的应用程序,我需要在 LinkedIn 上分享带有预定义内容的帖子。
我使用“react-native-share”在 LinkedIn 上共享内容,但它不起作用。我怎样才能做到这一点?
提前致谢。
解决方案
LinkedIn 只支持传递给它的一个参数,那就是url
参数。 它看起来像这样......
https://www.linkedin.com/sharing/share-offsite/?url={url}
来源:LinkedIn 官方分享文档。
以下参数将不起作用:summary
、title
、source
等。除此之外的任何东西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。
推荐阅读
- flutter - 当 showMenu 方法在颤动中调用时如何不关闭键盘?
- javascript - 带有 mailcheck.js 的 Angular5 反应式表单
- iis - 将所有子域重定向到新域
- json - How to manually decode json data in swift 4
- javascript - 使用 Rollup.js v1 捆绑一个 React 组件库
- typescript - 如何确保 T['someDynamicField'] 是 K 类型
- android - MediatorLiveData 直接从 ViewModel 绑定到 View
- php - 使用 Imagick 加载 PDF 文件:ERR_CONNECTION_RESET
- datatables - 数据表不保留更新记录的页面
- javascript - 有没有更好的方法来减少多个 if 语句?