M: When I am sent a link to a website through a messaging app, they’re usually is some form of photo associated with it that automatically loads. Trying to set up my own site – what do I need to do to get that to happen for my site?

G: To get a photo (or preview image) to appear automatically when you share a link to your site via a messaging app (like iMessage, Facebook Messenger, Discord, etc.), you need to include Open Graph meta tags in the <head> section of your HTML. These tags tell services how to generate the link preview.

Add the following to your site’s <head> section:

<meta property="og:title" content="Your Page Title Here" />
<meta property="og:description" content="A short description of your page." />
<meta property="og:image" content="https://example.com/path-to-image.jpg" />
<meta property="og:url" content="https://your-site.com/" />
<meta property="og:type" content="website" />

Replace:

Image Requirements

Optional (but smart) Extras

<meta property="og:site_name" content="Your Site Name" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Your Page Title" />
<meta name="twitter:description" content="Page description" />
<meta name="twitter:image" content="https://example.com/path-to-image.jpg" />

These add support for Twitter and help future-proof things.


Once you've added the tags:

  1. Upload the image and updated HTML file.
  2. Test it using tools like:

Let me know if you're using PHP for templating or want help generating the meta tags dynamically.