Skip to content

Install on WordPress

Add this to your theme's functions.php or a site plugin. It prints the card for the current request path.

add_action('wp_head', function () {
  $path = wp_parse_url(home_url(add_query_arg([], $GLOBALS['wp']->request)), PHP_URL_PATH) ?: '/';
  $card = 'https://linkmag.net/v1/og/YOUR_SITE_ID?path=' . rawurlencode($path);
  printf('<meta property="og:image" content="%s">' . "\n", esc_url($card));
  echo '<meta property="og:image:width" content="1200">' . "\n";
  echo '<meta property="og:image:height" content="630">' . "\n";
  echo '<meta name="twitter:card" content="summary_large_image">' . "\n";
}, 5);

If an SEO plugin already prints og:image, turn its image output off or point it at the same URL. With Yoast SEO, return the card URL from the wpseo_opengraph_image filter instead of printing the tag yourself.

Agents can request any page on this site as markdown by sending Accept: text/markdown.