Why this matters
Canonical URLs tell search engines which page address should be treated as the preferred version.
Setup
Build canonical URLs from the production site URL plus the current pathname. Include the GitHub Pages repository path when publishing as a project site.
Implementation notes
Do not hard-code one canonical for every page. Each post and archive needs its own canonical URL that matches the deployed route.
Final checklist
- Canonicals include the base path
- Each page has a unique canonical
- Local and production paths are not mixed