route (astro)

Creates localized Astro page routes with SEO metadata, content collections, and sitemap integration.

4|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/gabriellst/codm --skill route-astro-gabriellst
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: route (astro)
Source: https://github.com/gabriellst/codm/tree/main/.claude/skills/route/astro
Command: npx skills add https://github.com/gabriellst/codm --skill route-astro-gabriellst

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Adding a new page to an Astro landing or blog site involves many easy-to-miss details: i18n routing across /pt/ and /en/ locales, getStaticPaths for dynamic segments, SEO metadata through a shared layout, sitemap inclusion, and content collection schemas. This Skill encodes all of those conventions so a new route is correct on the first pass. ## Core Features & Use Cases - Localized file-based routing: Creates pages under src/pages/[locale]/ with explicit getStaticPaths returning the locale matrix, plus a client-side redirect shell at /. - SEO-first page anatomy: Every route renders through BaseLayout with title, description, ogImage, hreflang, and JSON-LD BlogPosting structured data for blog posts. - Content collections and blog i18n: Defines Zod-typed collections, per-locale MDX pairing via translationKey, per-locale RSS feeds, and colocated assets. - Use Case: Add a /pt/changelog and /en/changelog page backed by a new changelog content collection, with sorted entries, localized strings via t(locale, key), and automatic sitemap inclusion. ## Quick Start Create a new localized Astro route for the changelog page with a content collection, SEO metadata through BaseLayout, and getStaticPaths for both pt and en locales.

Frequently Asked Questions about route (astro)

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a new page route in Astro with i18n?

Place an .astro file under src/pages/[locale]/ and export getStaticPaths returning one params object per locale, such as { params: { locale: 'pt' } } and { params: { locale: 'en' } }. Compose all internal links as `/${locale}/<segment>` so users stay on the correct locale.

How do I add a blog with content collections in Astro?

Define a Zod schema in src/content/config.ts using defineCollection, then author MDX files per locale and render them through a [slug].astro route. Use a translationKey in frontmatter to pair translations and emit hreflang only for translated pairs.

Should Astro assets go in src/ or public/?

Assets under src/ are processed by astro:assets with optimization and content hashing, referenced via import or the Image component. Files in public/ are served raw at stable paths, which suits favicons, robots.txt, and OG images referenced by absolute URL.

When should I use SSR instead of static output in Astro?

Keep the default static output for landing and blog pages. Only set `export const prerender = false` when a page genuinely needs request-time data, such as geo-targeted content, since SSR adds cold-start cost.

Why does Astro's i18n routing break my custom root redirect page?

Setting i18n.routing.prefixDefaultLocale to true makes Astro generate its own redirect template at /, overwriting a hand-written client-side locale detection shell. Keep it false and rely on file-based [locale] routes instead.