astro-seo
Skill2 starsChanged 2 months agoMITView on GitHub
SEO wiring for Astro sites, covering canonical URLs, meta tags, sitemaps, robots.txt, and JSON-LD structured data. Use when adding pages, fixing indexing issues, or implementing structured data in an Astro project.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- RelayStack/astro-seo-skilltheir own version, first seen Oct 20, 2026
- RelayStack/astro-seo-toolkittheir own version, first seen Oct 13, 2026
- jdevalk/skillstheir own version, first seen Apr 16, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- jdevalk/skills★ 100same name
- RelayStack/astro-seo-toolkit★ 7same name
- RelayStack/astro-seo-skill★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository2 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 1 is distinctive, and 4 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
Every indexable page sets a unique <title> and <meta name="description">.
- Distinctive: line 29
Do it through the project's existing SEO component or layout props.
- Very specific: line 90
Use the integration's filter() option to exclude pages that shouldn't be indexed (thank-you pages, internal tools).
- Very specific: line 119
Keep JSON-LD builders in a plain .ts module (typed, testable), and keep them in sync with the visible page.
- Very specific: line 136
Every content image has meaningful alt text (see the astro-tailwind-best-practices skill for image handling).
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Astro SEO
How to wire SEO correctly in an Astro project. Each rule either follows the official Astro docs (linked) or is a field convention from running large Astro sites in production, marked as such.
Baseline: set site
Everything below depends on site being set in astro.config.mjs:
export default defineConfig({
site: "https://example.com",
});Without it, Astro.site is undefined, the sitemap integration can't build
absolute URLs, and canonical tags degrade to relative guesses. Check this
first when debugging SEO output.
Titles and descriptions
- Every indexable page sets a unique
<title>and<meta name="description">. Do it through the project's existing SEO component or layout props; don't hand-write meta tags per page if a component exists (field convention). - Titles read as page-specific first, brand second:
Pricing | Acme, notAcme, the best widgets | Pricing. - Descriptions are written for the search snippet: one or two sentences, roughly 150 characters, no keyword lists.
Canonical URLs
Build canonicals from Astro.url and Astro.site so every route gets one
automatically:
---
const canonical = new URL(Astro.url.pathname, Astro.site);
---
<link rel="canonical" href={canonical} />Field conventions:
- Pick one trailing-slash style (Astro's
trailingSlashoption) and make canonicals match it exactly. A canonical that redirects is wasted. - Pages reachable at multiple URLs (pagination, filters, UTM traffic) must canonicalize to the clean URL.
Open Graph and social cards
- Set
og:title,og:description,og:image,og:url, andtwitter:cardin the same SEO component as the rest of the head. og:imagemust be an absolute URL (build it withnew URL(path, Astro.site)), because relative paths silently fail on most platforms. Aim for 1200×630.- Static OG images live in
public/; generated ones come from an endpoint (e.g.src/pages/og/[slug].png.ts). Either is fine; the absolute URL is the part people get wrong.
Sitemap
Use @astrojs/sitemap;
never hand-maintain XML:
npx astro add sitemapThe build emits sitemap-index.xml plus numbered files. Per the docs, help
crawlers find it in both places:
<link rel="sitemap" href="/sitemap-index.xml" /># public/robots.txt
User-agent: *
Allow: /
Sitemap: https://example.com/sitemap-index.xmlUse the integration's filter() option to exclude pages that shouldn't be
indexed (thank-you pages, internal tools). If a page is excluded from the
sitemap for that reason, also give it
<meta name="robots" content="noindex" />: the sitemap is a hint, the
meta tag is the instruction (field convention).
JSON-LD structured data
Astro renders structured data as an inline script. Use set:html with
JSON.stringify; don't interpolate JSON into the template by hand:
---
const jsonLd = {
"@context": "https://schema.org",
"@type": "Product",
name: title,
offers: {
"@type": "Offer",
price: String(price),
priceCurrency: "USD",
},
};
---
<script type="application/ld+json" set:html={JSON.stringify(jsonLd)} />Field conventions:
- Keep JSON-LD builders in a plain
.tsmodule (typed, testable), and keep them in sync with the visible page. Google ignores structured data that contradicts what's rendered. - For a discounted price with a strikethrough original, add a
priceSpecificationwithpriceType: "https://schema.org/ListPrice"for the original price alongside theOffer's selling price. - Validate with Google's Rich Results Test after changing any builder.
- Common wins:
Product+Offeron pricing pages,Articlewith dates on posts,BreadcrumbListon nested sections,FAQPageonly for FAQs that are actually visible on the page.
Redirects and hygiene
- Configure moved URLs in Astro's
redirectsconfig (or the host's config) with 301s. Don't leave old URLs 404ing after a rename. - One
<h1>per page; heading levels don't skip. - Every content image has meaningful
alttext (see theastro-tailwind-best-practicesskill for image handling).
Before finishing
siteset in config; canonicals absolute and non-redirecting- Unique title + description on every new or changed page
og:imageis an absolute URL- Sitemap present, linked in head and robots.txt
- JSON-LD matches the visible page and passes Rich Results Test
- Renamed or removed routes have 301 redirects
Maintained by Michael Andreuzza at Lexington Themes: Astro + Tailwind themes that ship with AGENTS.md, scoped rules, and design skills out of the box.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

