Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Get Description Field to Display with LinkedIn Share API

When I post this JSON to the Share API:

{
  "comment": "Here is my comment",
  "content": {
    "title": "Here is my title",
    "description": "Description:  The picture will be of a blue and gold macaw",
    "submitted-url": "https://en.wikipedia.org/wiki/Macaw",  
    "submitted-image-url": "http://yourshot.nationalgeographic.com/u/ss/fQYSUbVfts-T7pS2VP2wnKyN8wxywmXtY0-FwsgxoJBD4C1qJrqA8EfaP7jL8gZYg0MJlb9NNBxrHhmaSdwF/"
  },
  "visibility": {
    "code": "anyone"
  }  
}

I see this in the Activity:

enter image description here

What I don't see is the content in the description field. I did not write our original integration to this, but my project manager claims that the LinkedIn UI originally showed these descriptions. Has something changed? Are we doing something wrong?

UPDATE:

I just noticed a similar question here:

Share On LinkedIn Description field not displayed in new UI

I'm actually not sure what I should do from an SO perspective since I provided extra content that I think would be helpful in identifying the problem.

like image 761
jriggins Avatar asked Mar 30 '17 23:03

jriggins


2 Answers

I have spent two weeks talking with the LinkedIn support staff and developers about this problem. Oh the humanity... Succinct summary...

  • If you have an image defined (using og:image or API), then no description will display in share preview.
  • If you have no image defined (using og:image or API), but you have a description defined (using og:description tag or API), then description will display in share preview.

Easiest way to test? GitHub has an og:image tag, but Wikipedia does not have an og:image tag. What do they look like in social sharing in LinkedIn?

Wikipedia: No og:image tag, but og:description displays.
GitHub: Yes og:image tag, but no og:description displays.

I also went through the hassle of making a super simple demo to test this hypothesis...

Working LinkedIn Share Link Demo Without og:image Tags:

<HTML><HEAD>
    <meta property="og:title" content="LinkedIn Share URL Test">
    <meta property="og:description" content="Testing description!">
    <meta property='og:url' content="https://www.revoltlib.com/linkedin-social-share-url-test.html"/>
</HEAD><BODY>This page has no og:image tag.</BODY></HTML>

You shouldn't need to have trouble finding a site with og:image tags, basically every site seems to have it!

After thorough testing, it seems to check out! I'm well aware that the Official Microsoft LinkedIn Share Documentation makes no mention whatsoever of this, but all of the real evidence seems to point in the opposite direction.

like image 158
HoldOffHunger Avatar answered Nov 05 '22 02:11

HoldOffHunger


What I found out playing with the api is that the description field is only shown if an image is not provided. While you can ommit the submitted-image-url property the linkedin crawler will place an image to the post if it finds in the meta of the page.

With this api call:

{
  "comment": "Here is my comment",
  "content": {
    "title": "Here is my title",
    "description": "Description:  The picture will be of a blue and gold macaw",
    "submitted-url": "https://developer.microsoft.com/hu-hu/"
  },
  "visibility": {
    "code": "anyone"
  }  
}

I could produce this post: linkedin post with description

Honestly I think this is a bug in there renderer.

like image 1
Zoltán Avatar answered Nov 05 '22 02:11

Zoltán