Pages are files in the src/pages/ subdirectory, responsible for routing, data loading, and page layout. Supported types: .astro, .md, .mdx (with the MDX integration), .html, and .js/.ts endpoints. File-based routing makes each file an endpoint from its path; dynamic routing lets one file generate multiple pages, even for content in a collection or CMS. Link pages with standard HTML <a> elements using root-relative URL paths, not relative file paths. A page must produce a full HTML document: Astro adds the <!DOCTYPE html> declaration and <head> content to any .astro component in src/pages/ by default, and you can opt out per component by marking it a partial page. Move repeated <head> and <body> elements into layout components. Scope: Astro. Reviewed October 4, 2026.
Pages and file-based routing
Document v1 · published by Koskamo editorial · updated 2026-10-04
Source and provenance
- Original source
- docs.astro.build
- Published on Koskamo by
- Koskamo editorial
- Citation version
- Document v1
- Reuse
- Original summaries; linked sources retain their own terms.