Open Graph fixes · Astro
Fix missing Open Graph tags in Astro
In Astro the Open Graph tags live in src/layouts/Base.astro, which writes the meta tags straight into the layout's <head>. Below is the complete snippet plus the one-tag fix for each of the 10 core tags our scanner checks, so you can patch exactly what the scan flagged.
The fix
Add this to src/layouts/Base.astro
---
// src/layouts/Base.astro
---
<head>
<title>Your page title</title>
<meta name="description" content="A one or two sentence summary of this page." />
<meta property="og:title" content="Your page title" />
<meta property="og:description" content="A one or two sentence summary of this page." />
<meta property="og:image" content="https://example.com/og.png" />
<meta property="og:url" content="https://example.com/page" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary_large_image" />
</head>- Open src/layouts/Base.astro in your Astro project.
- Paste the snippet and replace the sample title, description, image and URL with your own.
- Deploy, then scan the live URL: the scanner re-checks all 10 tags and lists what is still missing.
One tag at a time
Fix a single missing tag in Astro
title
<!-- in your layout's <head> -->
<title>Your page title</title>meta description
<!-- in your layout's <head> -->
<meta name="description" content="A one or two sentence summary of this page." />og:title
<!-- in your layout's <head> -->
<meta property="og:title" content="Your page title" />og:description
<!-- in your layout's <head> -->
<meta property="og:description" content="A one or two sentence summary of this page." />og:image
<!-- in your layout's <head> -->
<meta property="og:image" content="https://example.com/og.png" />og:url
<!-- in your layout's <head> -->
<meta property="og:url" content="https://example.com/page" />og:type
<!-- in your layout's <head> -->
<meta property="og:type" content="website" />og:site_name
<!-- in your layout's <head> -->
<meta property="og:site_name" content="Your site name" />twitter:card
<!-- in your layout's <head> -->
<meta name="twitter:card" content="summary_large_image" />twitter:image
<!-- in your layout's <head> -->
<meta name="twitter:image" content="https://example.com/og.png" />Check the Astro fix on a live URL
FAQ
Common questions
Where do Open Graph tags go in Astro?
In src/layouts/Base.astro. The snippet writes the meta tags straight into the layout's <head>.
Which Open Graph tags does Astro need?
At minimum og:title, og:description, og:image and og:url, plus twitter:card. The scanner checks 10 tags in total: title, meta description, og:title, og:description, og:image, og:url, og:type, og:site_name, twitter:card, twitter:image.
How do I confirm the Astro fix worked?
Deploy, paste the live URL into the free scanner, and check that every tag above passes. The simulator then draws the card for 30 platforms.