Linkedin sharing urls / not parsing open graph
Asked Answered
G

10

10

The Linkedin documentation can be found here

As it says, it needs:

og:title
og:description
og:image
og:url

Here is an example of my wordpress blog source code that for simplicity I use Jetpack plug-in:

<!-- Jetpack Open Graph Tags -->
<meta property="og:type" content="article" />
<meta property="og:title" content="Starbucks Netherlands Intel" />
<meta property="og:url" content="http://lorentzos.com/starbucks-netherlands-intel/" />
<meta property="og:description" content="Today I had some free time at work. I wanted to play more with Foursquare APIs. So the question: &quot;What is the correlation of the Starbucks Chain in the Netherlands?&quot;. Methodology: I found all the p..." />
<meta property="og:site_name" content="Dionysis Lorentzos" />
<meta property="og:image" content="http://lorentzos.com/wp-content/uploads/2013/08/starbucks-intel-nl-238x300.png" />

In Facebook it works great, or you can see the meta data here. However LinkedIn is more stubborn and doesn't really parse the data even the If you're unable to set Open Graph tags within the page that's being shared, LinkedIn will attempt to fetch the content automatically by determining the title, description, thumbnail image, etc.

I know that I don't have the og:image:width tag but Linkedin doesn't even parse title, description or url. Any ideas to debug it?

Gertiegertrud answered 27/8, 2013 at 14:54 Comment(0)
G
7

I checked again my html and found some warnings/errors in metadata. I fixed them and all work good. So the solution if you encounter the same problem:

Check your html again and debug it. Even if the page load well in your browser, the LinkedIn parser is not as powerful in terms of small errors. This tool might help.

Gertiegertrud answered 28/8, 2013 at 17:31 Comment(1)
In addition to fixing the errors in our html and in our meta tag, LinkedIn seems disinclined to scrape secure pages. Changing https to http was the final step for us to get LinkedIn sharing to work.Geller
C
4

My very first suggestion is appending a meaningless query to the URL, so that LinkedIn thinks it's a new link (this doesn't affect anything else) i.e.:

http://example.com/link.php?42 or http://example.com/link.html?refid=LinkedIn

If that doesn't suit your needs, a more drastic measure is in order.

After making sure you don't have any errors in your console and validating your site using: http://validator.w3.org/...

Add the prefix attribute to every tag (not to html tag), then re-sign in with your LinkedIn account to clear the cache...

prefix="go: http://ogp.me/ns#" i.e.:

<meta prefix="og: http://ogp.me/ns#" property="og:title" content="Title of Page" />
<meta prefix="og: http://ogp.me/ns#" property="og:type" content="article" />
<meta prefix="og: http://ogp.me/ns#" property="og:image" content="http://example.com/image.jpg" />
<meta prefix="og: http://ogp.me/ns#" property="og:url" content="http://example.com/" />

I hope one of these three solutions works for someone. Cheers!

Chichihaerh answered 15/9, 2014 at 19:53 Comment(2)
I am not sure whether this is related, but I am having tons of trouble getting OpenGraph metadata showing up on LinkedIn (work fine on Facebook). Strangely, LI doesn't seem to notice even standard <title> contents. Then I noticed this in the documentation: "you should be able to serve these display tags on https". So, maybe https? In my case I'm trying to link to a page hosted in Github Pages which do not work via https.Barytone
This was awesomely useful because after I fixed the issue I appended the attribute to make LinkedIn re-create the thumbnail.Bea
T
1

If you're sure you've done everything right (using open graph meta tags, no errors on validator.w3.org) and it still is not working, be sure to try it with a different page, it might be a LinkedIn cache thing.

I had a <h1>Project information</h1> on my page, which LinkedIn used as the title for sharing the page, instead of the <title> or <meta property="og:title" [...]/> tag. Even though I did everything right. But when I completely removed this <h1>Project information</h1> from the page source, it kept using 'Project information' as the title even thought it wasn't on the page anymore.

After trying a different page, it worked.

Triturate answered 3/4, 2015 at 10:10 Comment(0)
T
1

I stumbled about the same problem for our Wordpress site. The problem is created by conflicting OGP and oembed headers in standard wordpress + yoast / jetpack seo plugin.

You need to disabled the oembed headers with this plugin (this has no side effects): https://wordpress.org/plugins/disable-embeds/

After that you can force a fresh link preview by appending a ?1 as some of you guys already pointed out!

I hope that fixes your problem.

I wrote a detailed explanation for the problem here: https://pmig.at/2017/10/26/linkedin-link-preview-for-wordpress/

Thurston answered 27/10, 2017 at 7:41 Comment(0)
E
1

Linkedin caches the urls so it's very practical to make sure that this is not your problem before starting to debug.

This tool comes in handy: https://www.linkedin.com/post-inspector/inspect/

Here you can preview your urls and see how they looks like when shared. It refreshes the caching as well.

Elevation answered 7/9, 2020 at 10:30 Comment(0)
T
0

After a long trial and error I found out that my .htaccess was somehow blocking the Linkedin robot (wordpress site). For those who use the ithemes security plugin for wordpress or another security plugin make sure that LinkedIn is not blocked.
Make sure there is no line like: RewriteCond %{HTTP_USER_AGENT} ^Link [NC,OR]

The easiest way to check is to use wordpress default htaccess lines.

As mentioned before, make sure you don't retry cached pages in linkedin.

Trifoliate answered 5/1, 2016 at 15:42 Comment(0)
B
0

You can try this only once a week! I had a link to my site and I wanted to customize the image Linkedin displayed. So I added open graph tags which didn't seem to render at all. Until I read this:

The first time that LinkedIn's crawlers visit a webpage when asked to share content via a URL, the data it finds (Open Graph values or our own analysis) will be cached for a period of approximately 7 days.

This means that if you subsequently change the article's description, upload a new image, fix a typo in the title, etc., you will not see the change represented during any subsequent attempts to share the page until the cache has expired and the crawler is forced to revisit the page to retrieve fresh content.

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

Belting answered 18/1, 2016 at 13:11 Comment(0)
P
0

The solution for me was to add a hashbang. I am on an ajax style application which doesn't render the whole page, I think linkedin has a bit of a hissy fit about the text/image not being on the page on initial scrape, adding

%23!

to the end of my encoded url or

#!

to the unencoded url before sending it off to linkedin seemed to do the trick nicely for my share button popup. Not wsure if this is only Ajax/js apps or not but it certainly solved a couple of hours of effort for me.

I guess this is only useful if your application is setup to handle the escape_fragment in the url and render a static page not a dynamic one but I can't test this theory right now

Pine answered 8/2, 2016 at 17:56 Comment(0)
T
0

This was happening on one of my client's sites as well. I discovered that the .htaccess file was blocking the site from LinkedIn if the user-agents contained the string "jakarta".

As soon as I remove this filtering, LinkedIn was able to access all of the required the OpenGraph (og) information when the client would post a link.

Teetotum answered 1/9, 2016 at 21:22 Comment(0)
P
0

True, the documentation states that you can have: title, url, description, and image. But in reality, you have two options. Pick one of the two following sets and use it, as you have no other choice...

Set 1 Options

  • og:title
  • og:url
  • og:image

Set 2 Options

  • og:title
  • og:url
  • og:description

That is the reason why og:description is mysteriously missing from preview links. But if you drop image, then your description will finally display.

Try it: Wikipedia has an og description but no og image, while GitHub has both. Share Wikipedia and Share GitHub. Clearly seems like either you get a choice to display description or a choice to display image. I have spent weeks struggling with LinkedIn Support to correct this, but to no avail.

Pharyngitis answered 16/6, 2020 at 18:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.