How to share message via LInkedin

2.1k views Asked by At

I am trying create share button for sharing via Linkedin include title and description

I figured out that it possible to do via Custom URL, like that: https://www.linkedin.com/shareArticle?mini=true&url=http://developer.linkedin.com&title=LinkedIn%20Developer%20Network&summary=My%20favorite%20developer%20program&source=LinkedIn

Request parameters: enter image description here

if i try make it for my cause, it share only link not title and description:

https://www.linkedin.com/shareArticle?mini=true&url=https://www.athenatools.com/&title=ATHENA%20TOOLS&summary=THAT%20IS%20MY%20EXAMPLE&source=athenatools

Info i take from here: https://developer.linkedin.com/docs/share-on-linkedin

In conclusion, my question is how to make sharing include title, description and link at the site which i want

2

There are 2 answers

3
Marcin On

Your url and some of the parameters need to be urlencoded, so for example the url parameter should look like that: https%3A%2F%2Fathenatools.com%2F

You can use this tool: https://www.url-encode-decode.com/

1
HoldOffHunger On

As stated by Marcin, you must do URL encoding when passing one URL as a parameter to another URL's GET parameters (not just at LinkedIn URLs, but with all URLs). But there's actually still a bit more here to solve!

You seem to be using an old format of the LinkedIn share API. Since being acquired by Microsoft, much of LinkedIn's documentation (especially the up-to-date stuff) can be found on the Microsoft developer sites. Take a look: Official Microsoft LinkedIn Sharing Documentation. So, your URL should look like...

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

You are trying to also send a title and other parameters, but the only supported parameter is url.

You probably want to share title, etc., information, though, right? In that case, set the og: tags in the <head> block of your HTML page, like so...

  • <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 Documentation: Making Your Website Shareable on LinkedIn.

og: tags really are a good-standards practice, so why not? If you want to know that you set up everything correctly, LinkedIn has you covered there, too:

LinkedIn Post Inspector : Check the URL you are trying to share to make sure everything is properly configured, with the right og: tags, etc.. Input the URL you are sharing, i.e., example.com/YourSite/ThisPageIsWhatYouWantToBeSharedOnLinkedIn.

Hope this helps!