The Layout component
The primary layout issrc/layouts/Layout.astro, which wraps all pages on the site.
Layout structure
src/layouts/Layout.astro
Layout props
The Layout component accepts several props to customize each page:The page title. Appears in browser tabs and search results.
The meta description for SEO. Defaults to a site-wide description if not provided.
Custom Open Graph image URL for social media sharing. Defaults to a site-wide image.
The Open Graph type. Defaults to
'website'.Using layouts in pages
Import and wrap your page content with the Layout component:src/pages/about.astro
SEO and metadata
The Layout component automatically generates comprehensive SEO metadata:Open Graph tags
Twitter Card tags
Canonical URL
Structured data (Schema.org)
The layout includes JSON-LD structured data for better search engine understanding:Performance optimizations
The layout includes several performance enhancements:DNS prefetching
Resource preconnecting
Font preloading
Accessibility features
The layout includes built-in accessibility enhancements:Skip to main content
Semantic HTML
Multiple layouts
The project includes specialized layouts for different page types:LegalLayout
For terms, privacy policy, and legal pages:src/layouts/LegalLayout.astro
LiveLayout
For live streaming pages:src/layouts/LiveLayout.astro
Layout best practices
The slot mechanism
Layouts use Astro’s<slot /> to inject page content:
Layout.astro
page.astro
Next steps
Pages & routing
Learn about Astro’s routing system
Components
Explore reusable UI components