3

I'm adding a LinkedIn share button to my site. The URL that needs to be shared includes a parameter, but LinkedIn is stripping the parameter from the URL. Any way to get around this?

I've tried using a custom share URL e.g.

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

I've also tried using their share plugin e.g.

<script src="https://platform.linkedin.com/in.js" type="text/javascript">lang: en_US</script>
<script type="IN/Share" data-url="https://website.com/?par=1"></script>

Neither option is working for me. The URL just defaults to the root domain.

user715564
  • 1,650
  • 2
  • 25
  • 60
  • i tried accessing your url directly and it seams to be working fine. – Nicolas Feb 04 '20 at 17:21
  • What url? The one in the first example? That's just an example to show the format of that sharing option. That's not the actual url I am trying to share. – user715564 Feb 04 '20 at 17:23
  • Well if this one is working and not yours, that's probably because you are passing invalid parameters. – Nicolas Feb 04 '20 at 17:25
  • Please re-read my post. I'm having issues with parameters in the url that is being shared...not the share url parameters. – user715564 Feb 04 '20 at 17:28
  • Does this answer your question? [LinkedIn Share Post URL](https://stackoverflow.com/questions/33426752/linkedin-share-post-url) – HoldOffHunger Aug 18 '21 at 13:14

1 Answers1

2

LinkedIn no longer supports those parameters.

2010:

https://www.linkedin.com/cws/share?url={url}

2016:

https://www.linkedin.com/shareArticle?url={url}&title={title}&summary={text}&source={provider}

2020:

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

Unfortunately, we will have to survive with only a url parameter.

Source: Official Microsoft LinkedIn Share API Docs.

But, if you want to show a preview of some site info on the share page, before the user clicks to share it, you can use og: tags...

  • <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" />

Source: LinkedIn Developer Docs: Making Your Website Shareable on LinkedIn.

And when you're all done: Test it with the LinkedIn Post Inspector.

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
  • Not sure why this is downvoted. It's helpful and seems to be correct, according to the official documentation, which is cited. – Kev Apr 13 '22 at 11:12