Phase 4 - Skeleton Layout & Routing
Overview
Section titled “Overview”- Tier: Foundation (Phase 4 of 12)
- Scope: Essential, with one Recommended step (scope labels follow ADR-033)
- Effort: Moderate, depends on project complexity
- Dependencies: Phase 0-3 completed
- Deliverables: Base layout, routing structure, navigation, metadata system
- Code examples: Phase 4 - Code Examples
Entry Criteria
Section titled “Entry Criteria”- Design system configured
- Content architecture defined
- Tooling and CI functional
- Initial performance baseline planned
Implementation Steps
Section titled “Implementation Steps”| Step | Task | Scope | Notes |
|---|---|---|---|
| 4.01 | Create base layout | Essential | HTML structure, metadata |
| 4.02 | Build header component | Essential | Logo, nav, theme toggle |
| 4.03 | Build footer component | Essential | Links, copyright |
| 4.04 | Design mobile navigation | Essential | Responsive pattern |
| 4.05 | Create minimal page routes | Essential | index.astro & 404.astro only. See guide. |
| 4.06 | Set up metadata system | Essential | SEO, OpenGraph |
| 4.07 | Configure font loading | Essential | Preload, swap |
| 4.08 | Add security headers | Essential | CSP, HSTS |
| 4.09 | Set up skip links | Essential | Accessibility |
| 4.10 | Create error pages | Essential | 404, 500 |
| 4.11 | Review analytics options | Recommended | Optional. See dedicated guide. |
| 4.12 | Baseline performance | Essential | Initial metrics |
Analytics Setup
Section titled “Analytics Setup”This template does not include analytics out-of-the-box to respect user privacy. Adding analytics is an optional step that you can take based on your project’s needs. We have created a detailed guide with copy-paste recipes for popular, privacy-focused providers.
- Guide: Adding Web Analytics
This approach keeps the template clean while empowering you to make the right choice for your site.
Common Pitfalls
Section titled “Common Pitfalls”-
Missing Font Attributes: Forgetting crossorigin on preload
- Solution: Always include all required attributes
-
Blocking Resources: Scripts/styles blocking render
- Solution: Use defer/async, critical CSS inline
-
Poor Mobile UX: Desktop-first navigation
- Solution: Design mobile-first, test on devices
-
Missing Meta Tags: Incomplete SEO/social setup
- Solution: Use layout component for consistency
Exit Criteria
Section titled “Exit Criteria”- Base layout component complete
- Header with navigation functional
- Footer with links and social
- Mobile navigation working smoothly
- All main routes created
- Metadata system implemented
- Fonts loading optimally
- Security headers configured
- Skip links for accessibility
- Error pages created
- Analytics ready (privacy-first)
- Performance baseline recorded
Rollback Strategy
Section titled “Rollback Strategy”If skeleton needs major changes:
-
Layout Issues:
- Keep old layout as BaseLayoutV1
- Migrate pages gradually
- Test each migration
-
Route Changes:
- Set up redirects in config
- Update sitemap
- Check internal links
-
Performance Regression:
- Compare with baseline
- Check resource loading
- Review recent changes
AI Assistant Notes
Section titled “AI Assistant Notes”Key Files to Reference
Section titled “Key Files to Reference”src/layouts/BaseLayout.astro- Main layoutsrc/components/molecules/Head.astro- Metadata, Open Graph, and font loadingsrc/components/structural/*- Header/Footersrc/components/a11y/SkipLink.astro- Skip linkpublic/_headers- Security headersperformance-baseline.json- Performance baseline (written to the repo root bypnpm run perf:baselineagainst an already-running preview; the starter does not commit one)
Common Prompts for This Phase
Section titled “Common Prompts for This Phase”- “Create Astro layout with SEO metadata”
- “Build accessible mobile navigation”
- “Set up security headers for Astro”
- “Configure font preloading strategy”
Context Requirements
Section titled “Context Requirements”- Site structure and pages
- Brand/logo assets
- Navigation hierarchy
- Performance targets