如何制作自定义的 LinkedIn 分享按钮 [英] How to make a custom LinkedIn share button

查看:46
本文介绍了如何制作自定义的 LinkedIn 分享按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要能够向我的自定义按钮添加共享功能.我对他们的生成器不感兴趣,因为我无法更改 LinkedIn 图片那里.我想在领英分享按钮中使用我自己的图片.

I need to be able to add sharing functionality to my custom button. I'm not interested with their generator, as I can't change LinkedIn image there. I want to use my own image for the LinkedIn share button.

推荐答案

用于分享的官方 LinkedIn API:

Official LinkedIn API for sharing:

https://developer.linkedin.com/docs/share-on-linkedin

阅读使用条款!

使用自定义 URL"的示例链接方法:http://www.linkedin.com/shareArticle?mini=true&url=https://stackoverflow.com/questions/10713542/how-to-make-custom-linkedin-share-button/10737122&title=How%20to%20make%20custom%20linkedin%20share%20button&summary=some%20summary%20if%20you%20want&source=stackoverflow.com

Example link using "Customized URL" method: http://www.linkedin.com/shareArticle?mini=true&url=https://stackoverflow.com/questions/10713542/how-to-make-custom-linkedin-share-button/10737122&title=How%20to%20make%20custom%20linkedin%20share%20button&summary=some%20summary%20if%20you%20want&source=stackoverflow.com

您只需要使用 JavaScript 在弹出窗口中打开它或将其加载到 iframe.简单而有效 - 这就是我想要的!

You just need to open it in popup using JavaScript or load it to iframe. Simple and works - that's what I was looking for!

我检查过您无法在 LinkedIn 帖子中真正嵌入任何视频,唯一的选择是将链接添加到包含视频本身的页面.

I checked that you can't really embed any video to LinkedIn post, the only option is to add the link to the page with video itself.

您可以通过将 YT 链接放入 url 参数来实现:

You can achieve it by putting YT link into url param:

https://www.linkedin.com/shareArticle?mini=true&url=https://www.youtube.com/watch?v=SBi92AOSW2E

如果您指定 summarytitle 那么LinkedIn 将停止从视频中提取它,例如:

If you specify summary and title then LinkedIn will stop pulling it from the video, e.g.:

https://www.linkedin.com/shareArticle?mini=true&summary=youtube&title=f1&url=https://www.youtube.com/watch?v=SBi92AOSW2E

它与 Vimeo 的工作方式完全相同,并且可能适用于任何网站.希望它会有所帮助.

It does work exactly the same with Vimeo, and probably will work for any website. Hope it will help.

当您打开上面的链接时,您会看到 LinkedIn 加载了一些图片以及传递的 URL(以及可选的标题和摘要).

When you open above links you will see that LinkedIn loads some images along with the passed URL (and optionally title and summary).

LinkedIn 会自动执行此操作,您可以在此处阅读相关信息:https://developer.linkedin.com/docs/share-on-linkedin#opengraph

LinkedIn does it automatically, and you can read about it here: https://developer.linkedin.com/docs/share-on-linkedin#opengraph

虽然它说的很有趣:

如果存在 Open Graph 标签,LinkedIn 的爬虫将不必依靠它自己的分析来确定将共享哪些内容,这提高了共享信息的可能性正是您想要的.

If Open Graph tags are present, LinkedIn's crawler will not have to rely on it's own analysis to determine what content will be shared, which improves the likelihood that the information that is shared is exactly what you intended.

它告诉我,即使没有附加 Open Graph 信息,LinkedIn 也可以根据自己的分析提取这些数据.就 YouTube 而言,情况似乎确实如此,因为我找不到任何添加到 YouTube 页面的 Open Graph 标签.

It tells me that even if Open Graph information is not attached, LinkedIn can pull this data based on its own analysis. And in case of YouTube it seems to be the case, as I couldn't find any Open Graph tags added to YouTube pages.

这篇关于如何制作自定义的 LinkedIn 分享按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆