是否可以在LinkedIn Share插件中预先填充消息?

时间:2015-03-30 11:41:02

标签: linkedin linkedin-plugins

我们想使用LinkedIn Share widget;但是,我们希望使用一些默认文本预先填充消息。这可能吗?

以下是插件代码的示例

<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-counter="top"></script>

3 个答案:

答案 0 :(得分:1)

当您将共享插件传递给共享插件时,LinkedIn的抓取工具会访问该URL以尝试直接从页面中提取数据(来自现有的OpenGraph标记,或者通过分析DOM等元素,等等)

如果您想要更改共享的内容,您必须修改这些本地DOM元素以匹配您想要共享的内容(如果您自己控制页面),或者您不得不使用通过API调用或通过URL模式进行窗口小部件和交换机共享,这两者都允许您指定共享数据并避免爬虫代表您确定。

有关通过API和网址共享的其他文档,请访问:https://developer.linkedin.com/docs/share-on-linkedin

答案 1 :(得分:0)

您可以使用text参数来实现。

window.open("https://www.linkedin.com/shareArticle?mini=true&text=what are you waiting for?&url=https://www.example.com", "linkedin", "height=500,width=550,resizable=1");

在上述代码上附加事件处理程序,以在新窗口中打开。

请参考https://developer.linkedin.com/docs/share-on-linkedin以获得更多信息。

答案 2 :(得分:0)

当前,无法预先填充消息本身 Official LinkedIn Sharing Documentation 指出,以下URL共享格式是唯一可接受的格式...

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

但是! 您仍然可以为要发布消息的人显示网站预览。您可以通过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" />

带有og:标签的示例结果...

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

完成后,请测试您是否使用LinkedIn Post Inspector正确实施了所有操作。

相关问题