Skip to content
H Hans Martens
astro-rocket seo structured-data tutorial configuration

SEO in Astro Rocket: What's Built In and How to Configure It

Astro Rocket handles structured data, Open Graph, canonical URLs, sitemaps, and more out of the box. Here's exactly what ships and where to configure it.

H

Hans Martens

2 min read

SEO is one of those areas where “we’ve handled it” can mean anything from three meta tags to a complete implementation. Astro Rocket ships a complete one. Here is exactly what is included and where each piece lives.

What ships out of the box

The SEO layer covers six distinct concerns:

  1. Structured data (JSON-LD) — schema.org markup for the home page and every blog post
  2. Open Graph and Twitter Cards — social sharing metadata for every page
  3. Canonical URLs — preventing duplicate content penalties
  4. Sitemap — auto-generated and kept in sync with your pages
  5. Robots meta — per-page noindex / nofollow control
  6. Verification tags — Google Search Console and Bing Webmaster

None of these require per-page setup. They are wired into the base layout and run automatically.

Structured data

Structured data is the part most themes skip. Astro Rocket outputs JSON-LD schema.org markup on every page.

Home page outputs three schemas:

  • WebSite — site name, URL, and search action
  • Organization — your organisation name, logo, and contact details
  • Person — the site author

Blog posts output BlogPosting with full metadata:

{
  "@type": "BlogPosting",
  "headline": "Post title",
  "description": "Post description",
  "datePublished": "2026-03-17",
  "dateModified": "2026-03-17",
  "author": { "@type": "Person", "name": "Hans Martens" },
  "image": "https://yoursite.com/og-image.jpg"
}

Structured data does not guarantee rich results in Google Search, but it is a prerequisite for them. Posts with BlogPosting markup are eligible for article rich results and knowledge panel entries. Pages without it are not.

All values are pulled from site.config.ts and the post frontmatter — nothing is hardcoded.

Open Graph and Twitter Cards

Every page generates a complete set of social metadata. For regular pages:

<meta property="og:title" content="Page Title" />
<meta property="og:description" content="Page description" />
<meta property="og:image" content="https://yoursite.com/og-default.jpg" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary_large_image" />

Blog posts use their cover image automatically:

<meta property="og:image" content="https://yoursite.com/blog/post-cover.jpg" />
<meta property="og:type" content="article" />

The default OG image for non-blog pages is configured in site.config.ts:

defaultOgImage: '/og-default.jpg',

Drop your 1200×630 image into /public/ and update the path. Every page that does not have its own image will use it.

Canonical URLs

Every page outputs a canonical URL tag pointing to the primary URL of that page:

<link rel="canonical" href="https://yoursite.com/blog/my-post" />

This runs automatically — no frontmatter field required. The canonical URL is always constructed from the production domain set in site.config.ts, so it stays correct regardless of staging environments or preview deployments.

Sitemap

The sitemap is generated by @astrojs/sitemap and includes every page that Astro renders at build time. Blog posts, landing pages, the contact page — all included automatically.

The sitemap URL is https://yoursite.com/sitemap-index.xml. Submit it to Google Search Console once after deployment and Google will pick up new posts as they are published.

To exclude a page from the sitemap, mark it with noindex — the integration respects the same pages you would not want indexed.

Robots meta

Pages can be excluded from search engine indexing via the SEO component’s props:

<SEO noindex nofollow />

This renders:

<meta name="robots" content="noindex, nofollow" />

Use this for admin pages, thank-you pages after form submissions, staging pages, or any content you want crawlers to skip. The base layout applies index, follow by default to all other pages.

Verification tags

Search console verification codes go in site.config.ts — no template editing, no separate file:

googleSiteVerification: 'your-code-here',
bingWebmasterVerification: 'your-code-here',

Set them and they render in <head> on every page. Leave them empty and nothing is rendered.

Configuring the site identity

All structured data pulls from the site object in site.config.ts. The fields that feed directly into SEO output:

export const site = {
  name: 'Your Site Name',
  url: 'https://yoursite.com',
  description: 'Your site description for meta tags',
  author: {
    name: 'Your Name',
    url: 'https://yoursite.com/about',
  },
  organization: {
    name: 'Your Organisation',
    url: 'https://yoursite.com',
    logo: 'https://yoursite.com/logo.png',
  },
};

Fill these in accurately. The url field in particular must be the production URL — it feeds into canonical tags, OG image URLs, and structured data. An incorrect URL there breaks your canonical implementation and can cause indexing issues.

Blog post SEO

Each blog post has two frontmatter fields that feed directly into SEO:

  • title — becomes the page <title>, og:title, and BlogPosting.headline. Keep it under 60 characters for clean display in search results.
  • description — becomes the meta description and og:description. Keep it under 155 characters. Write it as a plain-language summary of the post — search engines use it as the snippet in results pages.

These two fields are the highest-leverage SEO work you will do for each post. Everything else is automatic.

Checking your SEO output

After deploying, verify with two tools:

Both are free and give you the ground truth on what search engines and social platforms actually see when they crawl your pages.

Back to Blog
Share:

Related Posts

Astro Rocket Configuration — Every Toggle, Theme, and Layout Option Explained

A complete walkthrough of Astro Rocket's configuration options: 13 colour themes, OKLCH colours, typography, radius and shadow tokens, header styles, dark mode, and more.

H Hans Martens
2 min read
astro-rocket configuration customization themes

How Astro Rocket's Design System Works — Tokens, Colors, and Dark Mode

Astro Rocket uses a three-tier token architecture with OKLCH colors. Change one value and the entire site updates. Here's how it works and how to make it yours.

H Hans Martens
2 min read
astro-rocket design-system tailwind customization tutorial

The Hero Typing Effect in Astro Rocket — How It Works and How to Tune It

Astro Rocket's hero headline cycles through words with a typing animation. Learn how it works, how to tune every speed and pause, and how to disable it entirely.

H Hans Martens
2 min read
astro-rocket components customization tutorial javascript

Follow along

Stay in the loop — new articles, thoughts, and updates.