200 blog posts shared as `localhost:3000` for 3 weeks. Root cause: OG URLs resolved against `localhost` in prod. The fix: Set `metadataBase`; generate absolute OG URLs.
A production war story from the TheCodeForge Next.js series — the incident, why it happened, and the exact fix.
⏳ Timestamps:
0:00 - Cold open: 200 blog posts shared with 'localhost:3000' for 3 weeks
0:12 - Version Compatibility: Next.js 16 Metadata API
0:46 - Production Caveat: Social Platform Caching
1:21 - Intro
1:33 - What Is Metadata API?
1:56 - Static vs Dynamic Metadata
2:30 - Dynamic generateMetadata
2:42 - Metadata Object Fields
3:16 - Dynamic OG Images
3:51 - Sitemaps & Robots
4:20 - Robots Example
4:32 - Canonical URLs
4:59 - JSON-LD Structured Data
5:25 - Testing & Validation
5:50 - Environment-Specific Metadata
6:16 - 200 blog posts shared with 'localhost:3000' for 3 weeks
6:41 - Missing generateMetadata for dynamic pages
6:53 - The Fix
7:13 - ⚠ Gotcha: Not setting metadataBase to production URL
7:27 - ⚠ Gotcha: Hardcoding localhost in metadataBase
7:39 - ⚠ Gotcha: Not exporting generateMetadata() on dynamic pages
7:54 - Debugging Guide
8:09 - Interview Questions
8:46 - FAQ
9:18 - Key Takeaways
9:32 - Next up
9:54 - Wrap-up
👉 Full article + code: https://thecodeforge.io/javascript/ne...
⏭ Next up: Deploying Next.js 16: Vercel, Self-Hosting, and Static Export
#nextjs #javascript