Pages
Pages are files that live in the src/pages/
subdirectory of your Astro project. They are responsible for handling routing, data loading, and overall page layout for every page in your website.
Supported page files
Section titled Supported page filesAstro supports the following file types in the src/pages/
directory:
.astro
.md
.mdx
(with the MDX Integration installed).html
.js
/.ts
(as endpoints)
File-based routing
Section titled File-based routingAstro leverages a routing strategy called file-based routing. Each file in your src/pages/
directory becomes an endpoint on your site based on its file path.
A single file can also generate multiple pages using dynamic routing. This allows you to create pages even if your content lives outside of the special /pages/
directory, such as in a content collection or a CMS.
Link between pages
Section titled Link between pagesWrite standard HTML <a>
elements in your Astro pages to link to other pages on your site. Use a URL path relative to your root domain as your link, not a relative file path.
For example, to link to https://example.com/authors/sonali/
from any other page on example.com
:
Read more <a href="/authors/sonali/">about Sonali</a>.
Astro Pages
Section titled Astro PagesAstro pages use the .astro
file extension and support the same features as Astro components.
------<html lang="en"> <head> <title>My Homepage</title> </head> <body> <h1>Welcome to my website!</h1> </body></html>