Menu

Keeping a Next.js job-board sitemap fresh: lessons from running Việc HOT
📰

Keeping a Next.js job-board sitemap fresh: lessons from running Việc HOT

DEV Community: webdev·Việc HOT·about 5 hours ago
#KNXkn6MY
#devtowebdev#devto#dev#sitemap#jobs
Reading 0:00
15s threshold

Running a Vietnamese job board ( Việc HOT ) taught us that job listings are the hardest content type to keep indexed: they appear and expire within days, and Google only finds them quickly if your sitemap is accurate.

1. Split sitemaps with generateSitemaps

Next.js App Router lets you shard sitemaps by id. We keep static pages, categories, companies and jobs in separate files so a single slow query never breaks the whole index.

// app/sitemap/[id]/route.ts (simplified) export async function generateSitemaps () { return [{ id : 0 }, { id : 40 }]; }

Enter fullscreen mode

Exit fullscreen mode

2. Revalidate after every import

Our first bug: new jobs showed on the site but not in the sitemap, because the sitemap was cached by ISR. The fix is to call revalidatePath('/sitemap/40.xml') (or revalidateTag('jobs') ) at the end of each import job, and purge the CDN path.

3. lastmod must be the real update time

Google ignores lastmod if it is always "now".…

Continue reading — create a free account

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