← ジャーナルに戻る
· 5 分で読了

Astro SEO Audit: How to Check Your Astro Site with Python

Astro is fast out of the box, but SEO mistakes still kill rankings. Here's how to audit an Astro site for SEO issues using a free Python CLI — no Ahrefs or browser extensions required.

Astro ships with most of what you need for good SEO: zero JS by default, fast rendering, built-in sitemaps. But that doesn’t mean your Astro site is automatically optimized. Missing canonicals, thin meta descriptions, broken internal links, missing alt text — these compound silently.

Most Astro SEO guides give you a checklist and tell you to manually inspect each page. That works for a 5-page site. For anything bigger, you need automation.

Here’s how to run a full SEO audit on an Astro site using Python — the same audit we run on every Astro project before deploy.

Why Astro Sites Have Specific SEO Patterns

Astro’s architecture creates a unique SEO profile:

Static HTML output. Pages render at build time, so Google sees the full content without executing JavaScript. This is a huge advantage over Next.js or Vue apps — but only if your build includes the right tags.

Content collections. Astro’s src/content/ system enforces a schema, which is great for consistency. But if your schema doesn’t include SEO-critical fields like description or custom canonical, every page ships without them.

Island architecture. Most content is static, but interactive islands (React/Vue/Svelte components) can cause layout shift if they hydrate above the fold. We’ve seen Astro sites with perfect LCP but terrible CLS because of a hydrated nav bar.

astro:content frontmatter = your meta tags. Unlike WordPress where SEO plugins handle this automatically, in Astro you need to explicitly wire frontmatter fields to <meta> tags in your layout. Miss the connection, and you get empty descriptions.

The Audit: What to Check

1. Meta Tags and Title Tags

Every page needs a unique <title> and <meta name="description">. In Astro, this means your layout component must receive these as props and render them.

Common mistake: setting a default title in the layout and forgetting to override it on individual pages.

# Run the audit
python3 -m zens_ink.site_audit https://your-astro-site.com \
  --checks meta

The audit flags:

  • Pages with duplicate titles (often your 404 or paginated pages)
  • Missing meta descriptions (Astro doesn’t generate these automatically)
  • Titles that are too long or too short for SERP display
  • Description tags that don’t match the page content

2. Canonical URLs

Astro builds directory-style URLs by default (/blog/my-post/ with trailing slash). If your astro.config.mjs has trailingSlash: 'ignore', you’ll get inconsistent canonical behavior — some pages with slash, some without.

python3 -m zens_ink.site_audit https://your-astro-site.com \
  --checks canonical

Watch for:

  • Self-referencing canonicals that don’t match the actual URL (caused by site not being set in config)
  • Missing canonical tags entirely (Astro doesn’t add them by default — you need <link rel="canonical" href={Astro.url} /> in your layout)

Pro tip: Set site in astro.config.mjs. Without it, Astro generates relative URLs in sitemaps and RSS feeds, which Google handles poorly.

3. Sitemap and Robots.txt

Astro’s @astrojs/sitemap integration generates sitemap-index.xml automatically. But there’s a catch:

  • SSR routes are excluded. If you have prerender = false pages, they won’t appear in the sitemap. You need to generate a supplemental sitemap for these.
  • site config is required. If you don’t set site: 'https://example.com' in your config, the sitemap URLs will be relative — and Google Search Console will reject them.

Run the sitemap checker:

python3 -m zens_ink.site_audit https://your-astro-site.com \
  --checks sitemap

It verifies:

  • Sitemap exists and is valid XML
  • All URLs in the sitemap return 200
  • No orphan pages (pages that exist but aren’t in the sitemap)
  • Sitemap is referenced in robots.txt

4. Structured Data (JSON-LD)

Astro doesn’t add structured data automatically. You need to hand-write the JSON-LD blocks in your layout or components. This is where most Astro sites fall short — they have great content but zero schema markup.

At minimum, every Astro site should have:

  • Organization or WebSite schema on the homepage
  • Article schema on blog posts
  • BreadcrumbList on all interior pages

The audit checks for presence and validity:

python3 -m zens_ink.site_audit https://your-astro-site.com \
  --checks schema

For a deeper dive into structured data implementation, see our Schema Markup for SEO guide.

Astro’s <a href="/blog/post/"> links work fine for users, but you need to verify:

  • No broken links (caused by renamed slugs or deleted pages)
  • All internal links use consistent trailing slashes (matching your trailingSlash config)
  • Orphan pages (not linked from anywhere on your site)
python3 -m zens_ink.site_audit https://your-astro-site.com \
  --checks links

Internal linking is the most underrated ranking factor. Read our Internal Linking SEO guide for the full strategy.

6. Image Alt Text

Astro’s <Image /> component from @astrojs/image doesn’t require alt text — but Google does. The audit flags every <img> without an alt attribute.

In Astro components, always pass alt text:

<Image src={post.data.cover} alt={post.data.title} width={1200} height={630} />

7. Core Web Vitals

Astro sites typically score well on LCP (no render-blocking JS) and CLS (static layout). But watch for:

  • INP issues from hydrated islands that block interaction
  • LCP regression from unoptimized images (use Astro’s built-in image optimization)
  • TBT from third-party scripts (analytics, cookie banners — use async or defer)

For the full Core Web Vitals breakdown, see our Page Speed SEO guide.

Running the Full Audit

Instead of checking each area separately, run the full pipeline:

python3 -m zens_ink.site_audit https://your-astro-site.com \
  --output report.md

This produces a prioritized report covering:

  • Meta tags (titles, descriptions, canonicals)
  • Sitemap integrity
  • Broken links and redirects
  • Schema markup presence
  • Image alt text
  • Mobile responsiveness signals
  • Robots.txt analysis

The report flags issues by severity: Critical (fix before deploy), Warning (fix this week), Info (nice to have).

Common Astro SEO Mistakes We See

After auditing dozens of Astro sites, here are the patterns:

  1. site not set in config. This breaks sitemaps, canonicals, and OG tags. Fix: export default defineConfig({ site: 'https://yourdomain.com' }).

  2. SSR pages missing from sitemap. Astro’s sitemap integration only includes prerendered pages. If you have [slug].astro pages with prerender = false, generate a supplemental sitemap.

  3. Inconsistent trailing slashes. If your config says trailingSlash: 'always' but internal links use bare paths (/blog/post instead of /blog/post/), every link triggers a 301 redirect. Wastes crawl budget.

  4. Missing OG images. Astro doesn’t auto-generate social cards. You need og:image in your meta tags, pointing to a real image URL.

  5. Empty descriptions from content collections. If your schema has description: z.string().optional() and you don’t fill it, the page ships with no meta description. Make it required or add a fallback.

Putting It Together

Astro gives you a fast, clean foundation. The audit ensures you haven’t left SEO gaps in your implementation. Run it before every deploy, track the issues over time, and your Astro site will outperform heavier frameworks on every technical SEO metric.

For the broader technical SEO audit methodology (not Astro-specific), see our Technical SEO Audit Without Paid Tools guide. For crawl budget optimization specific to Astro’s hybrid rendering, check our Crawl Budget guide.

The full audit tool is open source and part of the ZensInk SEO toolkit. Clone it, run it on your Astro site, and fix what it finds.

Want to run this analysis on your own site?

ZensInk Pro automates this pipeline. One command, from seed keywords to content plan.

Get Pro →