Controlling LinkedIn Share Previews with Open Graph Protocol
Learn how to use the Open Graph Protocol (OGP) and LinkedIn's Share API to control how your website's links appear in LinkedIn feeds, ensuring professional titles and images.
18 Mar 2026, 05:34 UTC

The Problem: Generic Link Previews
When users share a URL to LinkedIn, the platform attempts to generate a "rich preview" card. If your website lacks specific metadata, LinkedIn may pull a random image from the page, a truncated snippet of text, or display a generic link with no image at all. This reduces click-through rates and makes professional content appear unpolished.
The solution is implementing the Open Graph Protocol (OGP), a set of meta tags that explicitly tell LinkedIn's crawler (LinkedInBot) which title, description, and image to use for the share card.
Prerequisites
- A publicly accessible website hosted on an HTTPS server.
- Access to the HTML
<head>section of the target pages. - A hosted image (PNG, JPG, or WEBP) with a minimum resolution of 200x200 pixels.
Implementing OGP Meta Tags
LinkedInBot scrapes the HTML of the target URL to populate the share card. These tags must be placed within the <head> element of your page. If they are placed in the <body>, the crawler may ignore them.
Add the following configuration to your page:
<head>
<!-- The title of your page as it should appear in the LinkedIn feed -->
<meta property="og:title" content="Engineering the Future of Distributed Systems" />
<!-- A brief description (approx. 150 characters) to encourage clicks -->
<meta property="og:description" content="A deep dive into how we scaled our infrastructure to handle 10k requests per second." />
<!-- The absolute URL to the image used in the preview card -->
<meta property="og:image" content="https://example.com/images/og-share-card.jpg" />
<!-- The canonical URL of the page being shared -->
<meta property="og:url" content="https://example.com/blog/distributed-systems" />
</head>Technical Constraints for Images
To ensure the image renders correctly, adhere to these requirements:
- Accessibility: The image must be hosted on a public server. If the image is behind a login wall or blocked by
robots.txt, LinkedIn cannot display it. - Dimensions: While 200x200px is the minimum, a 1200x627px ratio is recommended for high-resolution displays.
- File Size: Keep images under 5MB to prevent crawler timeouts.
Integrating the Share API
Once the metadata is configured, you can trigger the share flow using the LinkedIn Share API endpoint. This is a GET request that redirects the user to LinkedIn's authentication and posting interface.
Endpoint: https://www.linkedin.com/sharing/share-offsite/
Required Parameter: url (The URL-encoded link to your page)
Example implementation for a sharing button:
<!-- Replace [YOUR_URL] with the encoded link to your page -->
<a href="https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fexample.com%2Fblog%2Fdistributed-systems"
target="_blank"
rel="noopener noreferrer">
Share on LinkedIn
</a>Verification and Diagnostics
LinkedIn caches OGP metadata. If you update your tags, the changes will not appear immediately for users who have already shared the link.
Using the Post Inspector
To bypass the cache and verify your implementation, use the LinkedIn Post Inspector. This tool simulates the LinkedInBot crawler and provides a real-time preview of the extracted tags.
- Navigate to the Post Inspector tool.
- Enter the target URL.
- Inspect the "Preview" section to ensure the
og:title,og:description, andog:imageare correctly mapped. - If the preview is incorrect, click the "Inspect" button again to force a refresh of the LinkedIn cache.
Diagnostic Decision Table
| Symptom | Likely Cause | Resolution |
|---|---|---|
| No image appears | Image URL is relative or 403 Forbidden | Use absolute HTTPS URLs; check server permissions |
| Old title persists | LinkedIn cache has not expired | Run URL through Post Inspector to clear cache |
| Generic link only | Meta tags are in <body> or blocked by robots.txt | Move tags to <head>; allow LinkedInBot access |
Limitations
- Authentication: LinkedIn cannot scrape metadata from pages requiring a password or session cookie. For private content, you must provide a public "landing page" with OGP tags that redirects to the private content.
- Dynamic Content: If your site is a Single Page Application (SPA) that renders content via JavaScript, the LinkedInBot may not execute the JS, resulting in empty previews. In these cases, Server-Side Rendering (SSR) or a pre-rendering service is required.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.