0
votes

We're trying to implement a basic LinkedIn share link using the LinkedIn Share API but are running into issues when we try and share our web application URL in particular

JS Fiddle of our implementation with our URL: https://jsfiddle.net/Jmackus/qthgoeL1/3/

<a target="_blank" rel="noopener noreferrer" href="https://www.linkedin.com/sharing/share-offsite/?url=https://hcm616.peoplestreme.net/linkedintest-sandbox/erec_external.asp">Share this on LinkedIn</a>

We get the below errors from LinkedIn:

Post Inspector URL: https://www.linkedin.com/post-inspector/inspect/https:%2F%2Fhcm616.peoplestreme.net%2Flinkedintest-sandbox%2Ferec_external.asp%3FjobId=1

Changing browsers and LinkedIn accounts doesn't resolve the issue and at this point we are unsure what's causing the issue

Does anyone have any ideas on what may be causing this?

1

1 Answers

0
votes

Your webpage is entirely generated in JavaScript, so there's nothing that the LinkedIn share URL can get to generate a preview. It needs that preview, so it can say "WebSite.com Article Site", so that people on their platform know exactly what they're sharing, etc..

Set your og: tags in the <head> block of your HTML, like so...

  • <meta property='og:title' content='Title of the website'/>
  • <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 Share Documentation: Making Your Website Shareable on LinkedIn

But, as you say, I plugged in your URL to the LinkedIn Post Inspector, and that indicates it is getting a server 500 error. I suspect there may be some server-side blocking against code LinkedIn connecting to your site?

Here's a website where I coded it up and it works perfectly: SortWords.com: Demo Dev Site. Check out the code -- sharing on LinkedIn is no problem. Why not copy/paste the URL used in the demo site here into new-test-page.html, upload it directly to your server, and see if you still have problems? And maybe try again after that with new-test-page.php?

Hopefully, it's just the og: tags! But I'm curious about the results after implementing that.