Urgent.News

What's breaking now, across thousands of outlets.

Tech

Why your OpenGraph tags break on LinkedIn (and how to actually fix it)

Last week someone asked me why their React app showed an empty card when shared on LinkedIn, even though their tags were right there in the code. The reason is simple: social scrapers don’t execute client-side JavaScript. Twitterbot, LinkedInBot, and Slackbot aren't full browsers. They run a quick GET request, look at the raw HTML coming from your server, grab whatever is inside <head> , and…

Last week, a developer asked why their React app displayed an empty card when shared on LinkedIn, despite having meta tags in place. The issue stems from social media scrapers, such as Twitterbot, LinkedInBot, and Slackbot, not executing client-side JavaScript. These bots perform a simple GET request, analyze raw HTML from the server, extract the content within the head section, and terminate the connection.

If you rely solely on client-side rendering like React or Vite without server-side rendering (SSR), the crawler only receives this initial markup:

<!DOCTYPE html>

<html>

<head>

<title>My App</title>

</head>

<body>

<div id="root">

</div>

<script src="/src/main.jsx"></script>

</body>

</html>

The meta tags are injected post-client-side hydration, meaning by the time the crawler has finished, the necessary tags are absent. To address this, you must ensure your meta tags exist within the initial HTML. Solutions include using platforms like Next.js, Remix, Astro, or static prerendering to accomplish this. Moreover, incorporating dynamic images is crucial; manually exporting images via tools like Figma for each blog post or product page can be tedious and inefficient.

Building a tool like ogcraft.dev, which offers two key functionalities, can streamline this process:

1. A raw HTML visualizer: A free tool that captures strictly the initial HTML (excluding client-side JavaScript) when scraping, allowing you to preview how platforms like Twitter and LinkedIn will render your content before sharing.

2. A crawl-back image engine: This API accepts a single tag in your HTML, such as <meta property="og:image" content="https://api.ogcraft.dev/api/v1/extract?template=modern-blog&url=https://mysite.com/blog/my-post">. Upon invocation, the service navigates to your page, extracts your existing meta tags (title, description, author), and generates an optimized dynamic card via CDN caching. This eliminates the need for heavy, slow processes like spinning up Puppeteer instances or handling large encoded payloads.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Restart-Python Class-1

How to use python in Linux? First open a terminal in your linux machine then type python3 . How to find a version of software? Enter the software name space double hyphen version.

  • Use python3 command in terminal to run Python
  • Clear screen with clear command after exit()
  • Function overloading not built-in in Python

cast(bool, x) is a promise to the type checker. At runtime it is the identity function.

In google/adk-python , the value that decides whether a tool call needs human confirmation reaches its caller through cast(bool, await ...) . typing.cast returns its second argument.

  • cast(bool, x) promises type checker, acts as identity function at runtime
  • Function returns second argument unchanged, eliminates static type warnings
  • Issue resolved by discovering safe branch contains return bool(...) statement

Path-Based Routing with Reverse Proxy: Serving Multiple Websites from One Domain

Hey developers 👋 At some point in our development journey, we’ve all played around with domains, subdomains, routes, reverse proxies, and enough DNS records to make us question our life choices.

  • Serve two websites from one domain with reverse proxy
  • Path-based routing displays correct URLs without redirects
  • Blog hosted separately, appears as subpath of main site

More from Saturday 12 September →