Dev.to WebDev 🛠 Dev 👁 0 📖 1 min read

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

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.

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 }];
}

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". Use the job's own updatedAt, not the time the sitemap was generated.

4. Remove expired jobs, keep their pages as noindex

Expired listings leave the sitemap and return noindex, follow without JobPosting markup, so users still land somewhere useful while Google drops them.

5. Complete JobPosting address fields

Search Console flags missing addressLocality and postalCode inside jobLocation.address. Filling them from structured location data fixed every warning for us.

You can see the result live on the latest jobs page and our free CV builder.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.