Menu

My blog looked fine. Its metadata did not.
📰

My blog looked fine. Its metadata did not.

DEV Community: nextjs·Lalit Bagga·8 days ago
#Pgwh6PtQ
#devtonextjs#devto#dev#build#localhost
Long article (570 words) — no AI summary yet.
Reading 0:00
15s threshold

My blog looked fine. Its metadata did not.

Every page loaded and every post rendered. But the canonical link, the social preview tags and the sitemap all said my blog lived at http://localhost:3000 .

The cause was a fix I had made earlier. A build once failed because one URL was empty, and I solved it with a safe default. After I moved the blog to Vercel, that default quietly filled the gap.

The first problem was loud. It stopped the build. The second one was quiet. Every build passed, and every page shipped with the wrong address.

The Build That Failed

My blog builds all of its public links from one value: the site's own address. The RSS feed uses it too.

Without that value, the build failed with an invalid URL error. It was annoying, but it was clear. The build stopped and said what was wrong.

The Fix That Made Sense

I gave the value a default, so a missing address would never break a build again:

export const SITE_URL = ( process . env . NEXT_PUBLIC_SITE_URL || "http://localhost:3000" ) .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.