【问题标题】:Is it possible to pre-populate the message in the LinkedIn Share plugin?是否可以在 LinkedIn Share 插件中预先填充消息?
【发布时间】:2020-06-01 22:32:34
【问题描述】:

我们想使用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>

【问题讨论】:

    标签: linkedin linkedin-plugins


    【解决方案1】:

    当您向共享插件传递一个 URL 以进行共享时,LinkedIn 的爬虫会访问该 URL 以尝试直接从页面中提取数据(从存在的 OpenGraph 标记,或者通过分析 DOM 元素,如 、's 等)

    如果您想更改共享的内容,如果您自己控制页面,则必须修改那些本地 DOM 元素以匹配您想要共享的内容,或者您​​必须不使用通过 API 调用或 URL 模式共享小部件和开关,这两种方式都允许您指定共享数据并避免爬虫代表您确定。

    有关通过 API 和 URL 共享的其他文档可在此处找到:https://developer.linkedin.com/docs/share-on-linkedin

    【讨论】:

      【解决方案2】:

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

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

      但是!!!您仍然可以为即将发布消息的人显示您的网站的预览。你可以通过og: 标签来做到这一点...

      • &lt;meta property='og:title' content='Title of the article"/&gt;
      • &lt;meta property='og:image' content='//media.example.com/ 1234567.jpg"/&gt;
      • &lt;meta property='og:description' content='Description that will show in the preview"/&gt;
      • &lt;meta property='og:url' content='//www.example.com/URL of the article" /&gt;

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

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

      当您全部完成后,测试您是否使用LinkedIn Post Inspector 正确实现了所有内容。

      【讨论】:

        【解决方案3】:

        您可以使用 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了解更多信息。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2015-12-22
          • 2015-06-28
          • 1970-01-01
          • 2020-06-16
          • 2021-11-20
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多