AutoSEO does the research, writing and optimisation and delivers the finished article as a signed webhook payload — your handler commits the MDX or writes the content collection entry.
What Makes Astro SEO Different From Other Frameworks
Astro ships zero JavaScript to the browser by default. Every page is rendered as static HTML at build time unless you explicitly opt into server-side rendering or client-side hydration. This single architectural fact changes almost every SEO decision you make: crawlers receive fully-formed HTML without waiting for JavaScript execution, Core Web Vitals scores start from a much stronger baseline, and the common React or Next.js pitfall of content hidden behind hydration simply does not exist in a default Astro build.
Understanding this output model is the foundation of Astro SEO. Before touching a sitemap plugin or a meta tag, you need to know exactly what Astro is sending to Googlebot — and why that gives you a structural advantage most frameworks cannot match out of the box.
How Astro Sites Are Structured for SEO Purposes
Astro projects follow a file-based routing system. Every .astro, .md, or .mdx file placed inside the src/pages/ directory becomes a route. The file path maps directly to the URL, which means your information architecture is visible in your folder structure — a significant advantage for keeping URL logic clean and auditable.
Static vs. SSR Output Modes
Astro supports two primary output modes that affect SEO in different ways:
- Static output (default): All pages are pre-rendered at build time. Every URL produces a physical HTML file. This is the fastest possible delivery method and the easiest for crawlers to index reliably.
- Server output (SSR): Pages are rendered on request. Useful for personalized content or large catalogs that cannot be statically generated, but it introduces server response time as a ranking variable. You must configure an adapter (Vercel, Netlify, Node, Cloudflare) and ensure your server responds quickly.
- Hybrid output: Individual pages or routes can be opted into SSR while the rest of the site remains static. This is the most flexible approach for large sites that mix editorial content with dynamic data.
For most content sites, blogs, and marketing pages, static output is the correct choice. For e-commerce or user-generated content, hybrid mode lets you keep product pages static while rendering account pages dynamically.
Content Collections and URL Structure
Astro's Content Collections API, introduced in version 2.0 and significantly improved in version 3.0, organizes Markdown and MDX files under src/content/. Collections are defined with a schema using Zod, which validates frontmatter fields at build time. From an SEO standpoint, this matters because it enforces that every piece of content has the required metadata fields — title, description, canonical URL — before the build succeeds. You cannot accidentally publish a page with a missing title tag if your schema marks it as required.
Technical SEO Levers Specific to Astro
Metadata and the Head Component
Astro does not have a built-in head management library equivalent to Next.js's next/head. Instead, you control the <head> directly in your layout components. The correct pattern is to create a reusable SEO.astro or BaseHead.astro component that accepts props for title, description, canonical URL, Open Graph tags, and Twitter Card tags, then include it in every layout.
The most common mistake here is duplicating head content. If a layout includes a head component and a page also manually adds meta tags, you end up with duplicate title tags or duplicate canonical URLs — both of which send conflicting signals to search engines. Centralizing all head logic in one component and passing data through props eliminates this risk entirely.
Canonical URLs
Astro provides the Astro.url and Astro.site globals, which make constructing canonical URLs straightforward. Setting site in your astro.config.mjs is a prerequisite — without it, Astro.site returns undefined and any canonical URL logic built on top of it will silently fail. Always verify your canonical tags in production output, not just in development, because the base URL differs between environments.
Sitemaps
The official @astrojs/sitemap integration generates a sitemap automatically from your static routes at build time. Configuration is minimal: add the integration to astro.config.mjs, ensure site is set, and the sitemap appears at /sitemap-index.xml after build. For large sites, the integration automatically splits the sitemap into multiple files.
Key configuration options that matter for SEO:
- filter: Exclude routes you do not want indexed, such as thank-you pages, internal search results, or paginated duplicates beyond page one.
- customPages: Add URLs that are not part of the static build — useful in hybrid or SSR setups where some routes are dynamically generated.
- changefreq and priority: These attributes have minimal practical impact on Google's crawl behavior, but they are useful signals for other search engines and for internal documentation of crawl intent.
- lastmod: Automatically populated from the build date unless you pass a custom value. For content collections, pull the
pubDate or updatedDate from frontmatter and inject it via a custom sitemap serializer.
Robots.txt
Astro does not generate a robots.txt file automatically. Place a static robots.txt in the public/ directory and it will be copied to the root of your build output. For sites with SSR routes, you may need to serve the file through your adapter's routing configuration rather than relying on static file serving.
Structured Data and Schema Markup
Astro's component model makes injecting JSON-LD straightforward. Create a typed Schema.astro component that accepts a structured data object as a prop and renders it inside a <script type="application/ld+json"> tag in the document head. Because Astro renders this server-side, the JSON-LD is present in the raw HTML response — no hydration required, no risk of Googlebot missing it.
Common schema types by Astro use case:
| Site Type |
Recommended Schema |
Key Fields |
| Blog or editorial |
Article, BlogPosting |
headline, author, datePublished, dateModified, image |
| Documentation |
TechArticle, BreadcrumbList |
name, description, breadcrumb, url |
| E-commerce |
Product, Offer, AggregateRating |
name, price, availability, ratingValue |
| Local business |
LocalBusiness, Organization |
name, address, telephone, openingHours |
| FAQ pages |
FAQPage, Question, Answer |
name, acceptedAnswer, text |
Performance and Core Web Vitals
Astro's zero-JS default is the single largest performance advantage it offers for SEO. Largest Contentful Paint scores on static Astro pages routinely outperform equivalent React or Vue pages because there is no render-blocking JavaScript bundle to parse. However, several Astro-specific patterns can still damage performance if applied carelessly:
- Unoptimized images: Use the
@astrojs/image integration or the built-in Image and Picture components from astro:assets (Astro 3+). These automatically generate WebP or AVIF variants, apply correct width and height attributes to prevent layout shift, and support lazy loading. Skipping this and using raw <img> tags is the fastest way to destroy your CLS and LCP scores.
- Client directives on above-the-fold components: Astro's island architecture lets you hydrate components with directives like
client:load, client:idle, or client:visible. Using client:load on a component in the hero section forces JavaScript to load immediately and blocks rendering. Use client:idle or client:visible for anything that does not need to be interactive on first paint.
- Third-party scripts in the head: Analytics, chat widgets, and ad scripts loaded synchronously in the head block the critical rendering path. Use Astro's
is:inline attribute carefully, and prefer loading third-party scripts with defer or async attributes, or through a Partytown integration for off-main-thread execution.
The Most Common Astro SEO Mistakes
Forgetting to Set the site Property
Every absolute URL Astro generates — canonical tags, sitemap entries, Open Graph image URLs — depends on the site property in astro.config.mjs. Leaving it unset causes these values to either error out or produce relative URLs that are invalid in contexts where absolute URLs are required. This is the single most common configuration mistake on new Astro projects.
Publishing Pages Without Canonical Tags
Astro does not inject canonical tags automatically. If your base layout does not include a canonical URL component, every page on your site is technically missing a canonical declaration. On sites with pagination, tag archives, or content syndicated from a headless CMS, this creates duplicate content problems that compound quickly.
Ignoring Pagination SEO
Astro's getStaticPaths function makes generating paginated routes simple, but it does not handle the SEO implications. Paginated pages need canonical tags pointing to themselves (not the first page), and you should carefully consider whether pages beyond page one should be indexed at all or consolidated using a canonical pointing to the root category or tag page.
Using client:load on Static Content
Wrapping static content — a navigation menu, a footer, a testimonial block — in a framework component with client:load forces unnecessary JavaScript onto the page. If a component does not need interactivity, write it as an .astro component with no client directive. Reserve hydration for components that genuinely require browser APIs or user interaction.
Skipping the robots.txt and Not Submitting the Sitemap
Because neither file is generated automatically without configuration, Astro projects frequently go live without a robots.txt or without the sitemap submitted to Google Search Console. The sitemap integration generates the file, but you must manually submit the sitemap URL in Search Console and verify that the robots.txt does not accidentally block crawling of the sitemap or key page paths.
Step-by-Step SEO Workflow for Astro Sites
The most effective SEO workflow for Astro combines static-site strengths with structured content operations: audit your site structure, research keywords, write optimized content, configure on-page elements in frontmatter, build and deploy, then submit URLs for indexing and monitor rankings over time.
Step 1: Audit Your Astro Site Structure
Before writing a single word, confirm your Astro project outputs clean, crawlable HTML. Run a crawl with Screaming Frog or Sitebulb and check for:
- Missing or duplicate title and meta description tags across page templates
- Broken internal links caused by incorrect base paths in
astro.config.mjs
- Images lacking alt attributes in Astro's Image component
- Pages excluded from the sitemap because sitemap: false was set accidentally in frontmatter
- Slow Largest Contentful Paint caused by unoptimized hero images or late-loading fonts
Fix structural issues first. Ranking improvements from content work are undermined when crawlers hit dead ends or duplicate metadata.
Step 2: Research Keywords at the Page Level
Map one primary keyword and two to four supporting keywords to each URL before writing. For a content collection entry, this mapping lives in a planning document or directly in frontmatter as a custom field. Prioritize keywords where:
- Search intent matches static informational or product content Astro delivers well
- Monthly search volume is realistic for your domain authority
- The SERP shows a mix of articles and tools, signaling Google accepts multiple formats
Use tools such as Ahrefs, Semrush, or Google Search Console's Performance report to find queries already sending impressions but not clicks — these are fast-win targets for existing pages.
Step 3: Write and Structure On-Page Content
Each Astro page or content collection entry should follow a consistent on-page checklist:
- Title tag: primary keyword near the front, under 60 characters, set via frontmatter and injected into <head> through a shared layout component
- Meta description: 140–155 characters, includes the keyword naturally, written as a benefit statement
- H1: one per page, matches or closely mirrors the title tag keyword
- H2 and H3 headings: use supporting keywords and question-based phrases that match People Also Ask results
- Body copy: answer the search intent in the first 100 words, then expand with detail, examples, and data
- Internal links: link to at least two related pages using descriptive anchor text, not "click here"
- Structured data: add JSON-LD via an Astro component in the layout for Article, FAQ, Product, or BreadcrumbList schema as appropriate
- Image optimization: use Astro's built-in Image component to serve WebP, set explicit width and height, and write descriptive alt text
Step 4: Configure Frontmatter for SEO Metadata
Astro's content collections use frontmatter as the single source of truth for SEO metadata. Define a Zod schema in config.ts that enforces required fields: title, description, pubDate, canonicalURL, and noindex. Your layout component reads these fields and populates <title>, <meta name="description">, and <link rel="canonical"> automatically. This prevents metadata from being forgotten on new pages and makes bulk audits straightforward — every SEO property is visible in one file per page.
Step 5: Build, Deploy, and Verify Output
Run astro build and inspect the dist folder before deploying. Spot-check that title tags, canonical URLs, and Open Graph tags rendered correctly in the static HTML. After deploying to Netlify, Vercel, Cloudflare Pages, or your preferred host, validate the live sitemap at /sitemap-index.xml and confirm robots.txt does not block Googlebot.
Step 6: Submit URLs for Indexing
New and updated pages need to be discovered quickly. Submit the sitemap URL in Google Search Console under Sitemaps. For individual high-priority pages, use the URL Inspection tool and request indexing manually. For Bing, submit the sitemap in Bing Webmaster Tools. If your Astro site uses an RSS feed — easy to generate with @astrojs/rss — submit the feed URL as well, since some crawlers and content aggregators use it as a discovery signal.
Step 7: Track Rankings and Iterate
Connect Google Search Console and Google Analytics 4 to monitor impressions, clicks, average position, and Core Web Vitals. Set up a rank-tracking project in Ahrefs or Semrush to watch target keywords weekly. Review performance at 30, 60, and 90 days after publishing. Pages that rank on page two for their primary keyword are strong candidates for a content refresh: expand thin sections, add FAQ schema, improve internal linking, and update the publish date in frontmatter to signal freshness.
How AutoSEO Automates the Entire Astro SEO Workflow
AutoSEO handles every stage of the SEO workflow — from keyword research through publishing and index submission — without requiring manual steps between tools. For Astro sites specifically, it connects to your repository, writes content that maps to your frontmatter schema, commits files to your content collections, triggers a build, and pings Google after deployment.
Research Phase: Automated Keyword Discovery
AutoSEO pulls keyword data from search APIs, analyzes your existing sitemap to avoid cannibalization, and produces a prioritized content plan. You review and approve topics before any content is written. The output includes a primary keyword, supporting keywords, target URL slug, and recommended schema type for each planned page — all formatted to match Astro frontmatter fields.
Write Phase: SEO-Structured Content Generation
AutoSEO generates content that follows the on-page checklist described above: optimized title tag, meta description, H1, structured heading hierarchy, internal link suggestions, and alt text for images. Output is formatted as Markdown with frontmatter, ready for Astro content collections. You can review drafts in the AutoSEO editor before committing anything to your repository.
Publish Phase: Direct Integration with Astro Repositories
AutoSEO connects to GitHub, GitLab, or Bitbucket. After approval, it commits the new .md or .mdx file to the correct content collection directory, which triggers your CI/CD pipeline and rebuilds the Astro site automatically. No copy-pasting between tools, no risk of frontmatter formatting errors.
Index Phase: Automatic URL Submission
Once the build completes and the new URL is live, AutoSEO uses the Google Indexing API and Bing Submission API to request crawling immediately. This cuts the typical discovery lag from days or weeks down to hours for sites that qualify for the Indexing API.
Track Phase: Unified Ranking Dashboard
AutoSEO pulls data from Google Search Console and rank-tracking APIs into a single dashboard. You see impressions, clicks, position, and Core Web Vitals per page alongside the content AutoSEO published. When a page stagnates, AutoSEO flags it for a refresh and can generate an updated draft automatically, maintaining the same URL and frontmatter slug to preserve link equity.
| Workflow Stage |
Manual Approach |
AutoSEO Approach |
| Keyword Research |
Ahrefs or Semrush, exported to spreadsheet |
Automated discovery, deduped against existing sitemap |
| Content Writing |
Writer follows brief, formats frontmatter manually |
SEO-structured draft generated, frontmatter auto-populated |
| Publishing to Astro |
Copy file to repo, push, wait for build |
Direct commit to content collection, build triggered automatically |
| Index Submission |
Manual URL Inspection in Search Console |
Indexing API call fired automatically post-deploy |
| Rank Tracking |
Separate rank tracker, manual reporting |
Unified dashboard tied to published content |
FAQ
Does Astro support dynamic SEO metadata for content collections?
Yes. Astro content collections let you define a Zod schema that enforces frontmatter fields like title, description, and canonicalURL. Your layout component reads these fields at build time and injects them into the <head> of each static HTML file. This means every page in a collection gets unique, validated metadata without any manual HTML editing.
How does Astro handle canonical URLs for SEO?
Astro does not set canonical URLs automatically. You need to add a <link rel="canonical"> tag in your layout component and pass the correct URL from each page's frontmatter or from Astro.url. For content collections, storing the canonical URL as a frontmatter field gives you explicit control and makes it easy to audit across all pages.
Is Astro's built-in sitemap good enough for SEO?
The @astrojs/sitemap integration generates a valid XML sitemap that includes all statically rendered pages. It supports filtering pages via the filter option and setting changefreq and priority values. For most sites it is sufficient. If you need per-page lastmod dates pulled from frontmatter, you will need a custom sitemap script or a plugin that reads content collection data.
How do you add structured data (JSON-LD) to an Astro page?
Create a reusable Astro component that accepts schema props and renders a <script type="application/ld+json"> tag. Place this component inside your layout's <head> and pass the appropriate schema type — Article, FAQPage, Product, BreadcrumbList — from each page's frontmatter. This approach keeps schema logic centralized and makes it easy to validate with Google's Rich Results Test after deployment.
Does Astro's partial hydration affect SEO?
No. Astro renders full HTML at build time regardless of which components are hydrated on the client. Search engines receive complete, readable HTML for every page. JavaScript-heavy interactive components hydrated with client:load or client:idle do not hide content from crawlers because the surrounding page content is already present in the static HTML output.
How do you handle SEO for Astro pages using server-side rendering (SSR)?
When using Astro's SSR mode with an adapter such as @astrojs/node or @astrojs/vercel, pages are rendered on request rather than at build time. SEO metadata still needs to be set in the <head> of each page, and you should ensure response times are fast enough to meet Core Web Vitals thresholds. For SEO-critical pages, consider using static pre-rendering (export const prerender = true) even within an SSR project to get the performance benefits of static HTML.
Can Astro sites rank well without a JavaScript framework?
Astro sites built with zero client-side JavaScript consistently score at or near 100 on Lighthouse performance audits, which directly supports Core Web Vitals metrics that Google uses as a ranking signal. Content-focused Astro sites without React, Vue, or Svelte components are among the fastest sites on the web by default, giving them a measurable technical SEO advantage over sites built with client-rendered frameworks.
What is the fastest way to get new Astro pages indexed by Google?
The fastest reliable method is submitting the URL through the Google Indexing API immediately after deployment. This requires verifying your site in Google Search Console and setting up API credentials. For sites that do not qualify for the Indexing API (which was originally designed for job posting and livestream pages but is used broadly in practice), the next best option is submitting the updated sitemap in Search Console and using the URL Inspection tool to request indexing manually for high-priority pages.