Posts

Showing posts from April, 2025

Overcoming Dynamic Route Handling in a Static Next.js + Firebase Hosting Project

Image
In one of the recent projects we worked on the SEO of a full-featured e-commerce website using Next.js which was hosted on Firebase Hosting . While this stack offers excellent performance and scalability, it also posed some unique challenges—especially when it came to handling dynamic routes in a statically exported Next.js project. Let me share one particularly interesting problem we solved: Enabling dynamic country-based brand pages (e.g., /pages/brands/india) while using static exports. The Challenge Next.js typically supports dynamic routing through its file-based system, where you can create pages like [slug].jsx. However, when using next export , all routes need to be known at build time since the project becomes a collection of static HTML files. This limitation became obvious when we needed a page like: /pages/brands/[country] We didn’t want to create a new file for every country. Instead, we wanted to use a single brands.jsx file that adapt...