Linkedin sharing urls / not parsing open graph

2019-01-26 08:29发布

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?

8条回答
Viruses.
2楼-- · 2019-01-26 09:10

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

查看更多
Root(大扎)
3楼-- · 2019-01-26 09:11

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.

查看更多
登录 后发表回答