How I Fixed Canonical URLs Pointing to Localhost in Next.js
A Next.js developer's own portfolio site was not being indexed by Google due to canonical URLs pointing to localhost. The issue was caused by a one-line code fallback in process.env.SITE_URL || 'http://localhost:3000'. The fix was to replace this with a centralized getPublicSiteUrl() helper. This restored full indexing after 13 files and 18 lines of code changes.