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

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

问题描述

我需要能够向我的自定义按钮添加共享功能.我对其生成器不感兴趣,因为我无法更改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"方法的示例链接:

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

尽管如此,它还是很有趣的:

It's interesting though as it says:

如果存在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天全站免登陆