DEV Community

Việc HOT
Việc HOT

Posted on

Adding JobPosting structured data to a Next.js job board (and the mistakes we fixed)

Google for Jobs only shows listings that carry valid JobPosting structured data. While building Việc HOT, a Vietnamese job board and free online CV builder, we went through several rounds of Search Console warnings before our job pages were marked valid. Here is a short, practical checklist.

1. Render JSON-LD on the server

Crawlers should see the markup in the initial HTML. In the App Router, put it in the page component:

export default async function JobPage({ params }: { params: { slug: string } }) {
  const job = await getJob(params.slug);
  const jsonLd = {
    "@context": "https://schema.org",
    "@type": "JobPosting",
    title: job.title,
    description: job.descriptionHtml,
    datePosted: job.postedAt.toISOString(),
    validThrough: job.expiresAt.toISOString(),
    employmentType: job.fullTime ? "FULL_TIME" : "PART_TIME",
    hiringOrganization: { "@type": "Organization", name: job.companyName },
    jobLocation: {
      "@type": "Place",
      address: {
        "@type": "PostalAddress",
        addressLocality: job.city,
        addressRegion: job.province,
        addressCountry: "VN",
      },
    },
  };
  return (
    <>
      <script
        type="application/ld+json"
        dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd).replace(/</g, "\\u003c") }}
      />
      {/* page UI */}
    </>
  );
}
Enter fullscreen mode Exit fullscreen mode

Escaping < prevents a job description containing </script> from breaking the page.

2. The fields that caused most warnings

  • validThrough: expired jobs must either drop out of the sitemap or return 404/410. Leaving them indexed with a past validThrough produces "expired job" issues.
  • addressLocality / addressRegion: imported jobs often only have a province. Map it to a city-level value instead of leaving it empty.
  • baseSalary: optional, but when present use MonetaryAmount with currency: "VND" and a unitText such as MONTH.
  • description: must match the visible description, not a truncated teaser.

3. Keep the sitemap honest

Set lastmod only when the job content actually changes. Re-stamping every job during a nightly import makes lastmod meaningless and wastes crawl budget. Also cache large sitemap files at the CDN: a sitemap that takes several seconds to generate can show up as "Couldn't fetch" in Search Console.

4. Test before deploying

Use Google's Rich Results Test on a few real job URLs, then watch the Job postings report in Search Console for a week after each change.

If you are job hunting in Vietnam, you can browse listings at viec.hot/tim-viec-lam or build a CV for free at viec.hot/tao-cv.

Top comments (0)