# Automate validation after each deployment

- Check 15.23 · Schema.org structured data · Important
- Source: https://checklist-seo-geo.com/en/schemaorg-structured-data/automate-validation-after-each-deployment
- Automatically check your templates' JSON-LD on every deployment: ready-to-use script, GitHub Actions, GitLab, Vercel, Netlify, Laravel, WordPress, Shopify.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/schemaorg-structured-data/automate-validation-after-each-deployment.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

A deployment can break structured data without anyone noticing: a JSON-LD block removed by a theme update, an empty price after an API change, a badly formatted date, a duplicate added by an app. The check consists of running an automated check on one URL per template after each release (and before, when possible). Once it is in place, the pipeline fails or raises an alert within minutes of a faulty deployment, well before Search Console reports it.

## Why it matters

Google points this out in its introduction to structured data: pages can break after a deployment because of the template or the server, hence the need to monitor the rich result reports. But these reports depend on crawling: a regression shows up after several days, on a sample, and validating its fix takes about two weeks.

Structured data is generated by templates. An error therefore affects every page of a type at once, and it stays invisible on screen: visitors do not read the JSON-LD. Only an automated check on representative URLs catches it when it happens.

Manual tools are not enough for this role. The Rich Results Test has no public API, and neither does the Schema Markup Validator. Search Console's URL Inspection API reflects what Google knows about the URL, not the version that has just been deployed. Post-deployment checks therefore rely on your own scripts, possibly supplemented by an open source validator.

## What it improves

- **Detection time**: a few minutes after deployment, compared with several days in Search Console.
- **Rich results**: fewer periods without stars, prices or breadcrumbs after a release.
- **Merchant listings**: a missing price or availability is caught before Merchant Center disapproves products.
- **Peace of mind for updates**: plugins, themes and apps can be updated with a safety net.
- **Rankings**: no direct effect.

## How to check

The check is in place if all three conditions are met:

1. The deployment pipeline, or a scheduled job, contains a step dedicated to structured data, with a list of URLs per template.
2. This step actually fails when there is a problem. To prove it, deliberately break a template in staging (remove `datePublished` or add an extra comma in the JSON-LD) and deploy: the check must fail and notify someone.
3. The failure reaches someone who can act: pipeline notification, a message in the team's chat tool or a ticket.

## How to implement

### Before you start

Three levels of checks, from the simplest to the most complete:

| Level | What is checked | Tool |
|---|---|---|
| 1. Presence and syntax | 200 response, readable JSON-LD blocks, expected types present, no duplicates | Script below, no dependencies |
| 2. Business rules | Essential properties not empty, ISO 8601 dates, absolute URLs | Script below, configured per template |
| 3. Vocabulary and Google requirements | Valid schema.org properties and types, fields required for rich results | Open source validator (step 3) |

Choose the test URLs: one per template and per special case (product with variants, out-of-stock product, article with several authors). Prefer stable content that will not be deleted tomorrow. Ten to thirty URLs are enough for most sites.

### Step 1 — Describe what is expected

Create `schema-checks.json` at the root of the repository:

```json
[
  { "path": "/", "required": { "Organization": ["name", "url", "logo"], "WebSite": ["name", "url"] } },
  { "path": "/thes/sencha-bio/", "required": { "Product": ["name", "image", "offers.price", "offers.priceCurrency", "offers.availability"], "BreadcrumbList": ["itemListElement"] } },
  { "path": "/blog/choisir-the-vert/", "required": { "BlogPosting": ["headline", "datePublished", "dateModified", "author.name", "image"] } }
]
```

For each URL, `required` maps a schema.org type to the properties that must never be empty. The `offers.price` notation goes down into nested objects; if `offers` is an array, the first item is checked. Start from the required and recommended properties in Google's documentation for each type (see [fill in required and recommended properties](https://checklist-seo-geo.com/en/schemaorg-structured-data/fill-required-recommended-properties)), then add your own rules.

### Step 2 — Add the check script

Save this script as `scripts/check-structured-data.mjs`. It only needs Node.js 18 or later, with no package to install; use an LTS version that is still maintained (22, 24 or 26 in November 2026):

```js
// scripts/check-structured-data.mjs
import { readFile } from 'node:fs/promises';

const rawUrl = (process.argv[2] ?? process.env.SITE_URL ?? '').replace(/\/$/, '');
const baseUrl = rawUrl && !/^https?:\/\//.test(rawUrl) ? `https://${rawUrl}` : rawUrl;
const configPath = process.argv[3] ?? 'schema-checks.json';

if (!baseUrl) {
  console.error('Usage: node scripts/check-structured-data.mjs https://example.com [schema-checks.json]');
  process.exit(2);
}

const headers = { 'User-Agent': 'structured-data-check' };

if (process.env.CHECK_HEADER) {
  const [name, ...value] = process.env.CHECK_HEADER.split(':');
  headers[name.trim()] = value.join(':').trim();
}

const isoDate = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;
const checks = JSON.parse(await readFile(configPath, 'utf8'));
let errorCount = 0;

const first = (value) => (Array.isArray(value) ? value[0] : value);
const nodesOf = (data) => [data].flat().flatMap((item) => (item?.['@graph'] ? [item['@graph']].flat() : [item]));
const typesOf = (node) => [node?.['@type'] ?? []].flat();
const valueAt = (node, property) => property.split('.').reduce((value, key) => first(value)?.[key], node);
const isEmpty = (value) => value === undefined || value === null || value === '' || (Array.isArray(value) && value.length === 0);

for (const { path, required } of checks) {
  const errors = [];
  const response = await fetch(`${baseUrl}${path}`, { headers, redirect: 'manual' });

  if (response.status !== 200) {
    errors.push(`HTTP ${response.status}`);
  } else {
    const html = await response.text();
    const blocks = [...html.matchAll(/<script[^>]*type=["']application\/ld\+json["'][^>]*>([\s\S]*?)<\/script>/gi)];
    const nodes = [];

    blocks.forEach(([, json], index) => {
      try {
        nodes.push(...nodesOf(JSON.parse(json)));
      } catch (error) {
        errors.push(`JSON-LD block #${index + 1} unreadable: ${error.message}`);
      }
    });

    for (const [type, properties] of Object.entries(required)) {
      const matches = nodes.filter((node) => typesOf(node).includes(type));

      if (matches.length === 0) {
        errors.push(`type ${type} missing`);
        continue;
      }

      if (matches.length > 1 && new Set(matches.map((node) => node['@id'])).size > 1) {
        errors.push(`${matches.length} different ${type} nodes (duplicate?)`);
      }

      for (const property of properties) {
        const value = valueAt(matches[0], property);
        const key = property.split('.').pop();

        if (isEmpty(value)) {
          errors.push(`${type}.${property} missing or empty`);
        } else if (key.startsWith('date') && !isoDate.test(String(first(value)))) {
          errors.push(`${type}.${property} is not an ISO 8601 date: ${first(value)}`);
        } else if (['url', 'image', 'logo', 'item'].includes(key) && !/^https:\/\//.test(String(first(value)?.url ?? first(value)?.['@id'] ?? first(value)))) {
          errors.push(`${type}.${property} is not an absolute https URL`);
        }
      }
    }
  }

  errorCount += errors.length;
  console.log(`${errors.length ? 'FAIL' : 'OK  '} ${path}`);
  errors.forEach((error) => console.log(`      ${error}`));
}

console.log(`${checks.length} URLs checked, ${errorCount} issue(s).`);
process.exit(errorCount > 0 ? 1 : 0);
```

Usage:

```bash
node scripts/check-structured-data.mjs https://example.com
```

The script prints `OK` or `FAIL` for each URL with the details of the issues, and exits with code 1 if there is a problem, which makes the pipeline step fail. For a protected staging site, pass a header in the `CHECK_HEADER` variable, for example `CHECK_HEADER="Authorization: Basic dXRpbGlzYXRldXI6bW90LWRlLXBhc3Nl"`, storing the value in the pipeline's secrets.

The script reads the HTML returned by the server, without running JavaScript. This is intentional: it checks what bots read without rendering. If your markup is injected on the client, see [check rendered structured data](https://checklist-seo-geo.com/en/javascript-html-rendering/check-rendered-structured-data).

### Step 3 — Validate the vocabulary (optional)

The open source package `@adobe/structured-data-validator` checks the markup extracted from a page against both schema.org and the requirements of Google's rich results. It works with the `@marbec/web-auto-extractor` extractor:

```bash
npm install --save-dev @adobe/structured-data-validator @marbec/web-auto-extractor
```

```js
// scripts/validate-schema-org.mjs
import WebAutoExtractor from '@marbec/web-auto-extractor';
import Validator from '@adobe/structured-data-validator';

const schemaOrg = await (await fetch('https://schema.org/version/latest/schemaorg-all-https.jsonld')).json();
const validator = new Validator(schemaOrg);
let errorCount = 0;

for (const url of process.argv.slice(2)) {
  const html = await (await fetch(url)).text();
  const data = new WebAutoExtractor({ addLocation: true, embedSource: ['rdfa', 'microdata'] }).parse(html);
  const issues = await validator.validate(data);

  for (const issue of issues) {
    console.log(`${issue.severity} ${url}: ${issue.issueMessage}`);

    if (issue.severity === 'ERROR') {
      errorCount++;
    }
  }
}

process.exit(errorCount > 0 ? 1 : 0);
```

```bash
node scripts/validate-schema-org.mjs https://example.com/ https://example.com/thes/sencha-bio/
```

This validator is not a Google tool: its verdicts may differ from those of the Rich Results Test, which remains the reference when in doubt. Pin the package version in `package.json` and read its release notes before updating it.

### Step 4 — Hook the check into deployment

The following sections give the configuration for each environment. The principle is always the same: run the script against the URL that has just been deployed, fail the step and notify when there is a problem.

### With GitHub Actions

A daily check at a fixed time, to detect changes made outside the repository (from a CMS admin, for example), with the option of running it manually. File `.github/workflows/structured-data.yml`:

```yaml
name: Structured data

on:
  schedule:
    - cron: '15 6 * * *'
  workflow_dispatch:

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: 24
      - name: Check the JSON-LD
        env:
          SITE_URL: https://example.com
          CHECK_HEADER: ${{ secrets.CHECK_HEADER }}
        run: node scripts/check-structured-data.mjs
```

If your pipeline deploys the site itself, simply add the "Check the JSON-LD" step at the end of the deployment job. A failure turns the workflow red and GitHub notifies people according to each person's notification preferences.

### With GitLab CI

Add a job in the `.post` stage, which runs after all the others, in `.gitlab-ci.yml`:

```yaml
structured-data:
  stage: .post
  image: node:24
  script:
    - node scripts/check-structured-data.mjs "$SITE_URL"
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
```

Define `SITE_URL` (and `CHECK_HEADER` if needed) in the project's CI/CD variables. For a daily check, create a scheduled pipeline (Pipeline schedules) that runs this job.

### Vercel

Versions: Vercel, all plans, with the GitHub integration, November 2026.

Vercel sends GitHub `repository_dispatch` events every time a deployment's status changes, with the deployment URL in `github.event.client_payload.url`. Vercel recommends this trigger over the older `deployment_status`. File `.github/workflows/structured-data-vercel.yml`:

```yaml
name: Structured data after Vercel deployment

on:
  repository_dispatch:
    types:
      - 'vercel.deployment.success'

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
        with:
          ref: ${{ github.event.client_payload.git.sha }}
      - uses: actions/setup-node@v7
        with:
          node-version: 24
      - name: Check the JSON-LD
        env:
          SITE_URL: ${{ github.event.client_payload.url }}
          CHECK_HEADER: ${{ secrets.CHECK_HEADER }}
        run: node scripts/check-structured-data.mjs
```

The event covers previews as well as production; filter on `github.event.client_payload.environment` if you only want to check one of them. The workflow must exist on the default branch to trigger. If Deployment Protection is enabled, previews reject the script: create a "Protection Bypass for Automation" secret in the project's Deployment Protection settings, then store the value `x-vercel-protection-bypass: YOUR_SECRET` in the `CHECK_HEADER` GitHub secret.

### Netlify

Versions: Netlify, all plans, Build Plugins, November 2026.

Add a local build plugin in `plugins/structured-data-check/`, with a `manifest.yml` file containing `name: structured-data-check`, a `package.json` file containing `{ "type": "module" }` (Node.js requires it for the `export` syntax below) and an `index.js` file:

```js
// plugins/structured-data-check/index.js
import { execFileSync } from 'node:child_process';

export const onSuccess = function ({ utils }) {
  try {
    execFileSync('node', ['scripts/check-structured-data.mjs', process.env.DEPLOY_URL], { stdio: 'inherit' });
  } catch (error) {
    utils.build.failPlugin('Structured data not compliant', { error });
  }
};
```

Declare it in `netlify.toml`:

```toml
[[plugins]]
package = "./plugins/structured-data-check"
```

The `onSuccess` event runs once the deployment has succeeded and cannot prevent it: the failure shows up in the deploy log and in the plugin's notifications. `DEPLOY_URL` points to the deployment's unique address. To block publication, you would need to check the generated HTML files in `onPostBuild`, before going live.

### Laravel

Versions: Laravel 11 to 13, Pest 3 and later; Laravel Forge and Envoyer, November 2026.

Two complementary checks.

**Before deployment**, a Pest test checks the types published by each template, on a test database populated by your factories:

```php
dataset('schemaPages', [
    'home' => ['/', ['Organization', 'WebSite']],
    'article' => ['/blog/choisir-the-vert', ['BlogPosting', 'BreadcrumbList']],
]);

it('publishes readable JSON-LD with the expected types', function (string $path, array $types): void {
    $html = $this->get($path)->assertOk()->getContent();

    preg_match_all('/<script type="application\/ld\+json">(.*?)<\/script>/s', $html, $matches);

    $foundTypes = collect($matches[1])
        ->map(fn (string $json): array => json_decode($json, true, flags: JSON_THROW_ON_ERROR))
        ->flatMap(fn (array $data): array => $data['@graph'] ?? [$data])
        ->flatMap(fn (array $node): array => (array) ($node['@type'] ?? []))
        ->all();

    expect($foundTypes)->toContain(...$types);
})->with('schemaPages');
```

**After deployment**, add the script at the end of the Laravel Forge deploy script (site settings, `Deployments` section), after the `$ACTIVATE_RELEASE()` macro if the site uses zero-downtime deployments, or in a Laravel Envoyer hook placed after the "Activate New Release" step:

```bash
node scripts/check-structured-data.mjs https://example.com
```

An error exit marks the deployment as failed and triggers the configured notifications. It does not roll back: the code is already live, so it is up to you to fix it or redeploy the previous version.

### Next.js

Versions: Next.js 15 and 16 (App Router and Pages Router).

In the continuous integration pipeline, before deployment, build and then start the application and check it locally:

```yaml
      - run: npm ci
      - run: npm run build
      - run: npm run start &
      - run: for i in $(seq 1 30); do curl -sf http://localhost:3000/ > /dev/null && break; sleep 1; done
      - run: node scripts/check-structured-data.mjs http://localhost:3000
```

The pages must be able to build with the data available in the pipeline (staging API, test dataset). Add the post-deployment check described for Vercel, or the step added at the end of your deployment job.

### WordPress

Versions: WordPress 6.4 to 7.1, WP-CLI 2.x.

Content and plugins change without going through a repository: the scheduled daily check (`schedule` in GitHub Actions, or a cron job on a server) is essential. Also run it after every plugin, theme or WooCommerce update, ideally in staging first. With WP-CLI, the sequence after an update becomes:

```bash
wp plugin update --all && wp cache flush && node scripts/check-structured-data.mjs https://example.com
```

Also clear the page cache or CDN cache if the site uses one, otherwise the script checks the old version.

### Shopify

Versions: Online Store 2.0 themes, all Shopify plans, November 2026.

Changes go through the theme editor or through apps, with no deployment to follow. Schedule the daily check on the live store. Before publishing a new theme, check its preview: store URLs accept the `preview_theme_id` parameter, which you can add to the paths in `schema-checks.json` (`/products/sencha-bio?preview_theme_id=123456789`). After installing or updating a review app, rerun the check manually with `workflow_dispatch`.

### With Screaming Frog

The paid version of Screaming Frog can schedule crawls with structured data validation and export the errors, from the interface or from the command line. It is a good solution for checking the whole site every week, alongside the script that checks a few URLs on every deployment. See [schedule automated crawls](https://checklist-seo-geo.com/en/automation-quality-control/schedule-automated-crawls).

## Common mistakes

- **A check that never fails the pipeline**: a script that prints errors but exits with code 0, or a step marked "allowed to fail".
- **Testing a random URL** rather than one URL per template and per special case.
- **Testing before the cache is purged**: the script validates the old version.
- **Test URLs that disappear** (product deleted, article unpublished): the check fails for the wrong reason and the team ends up ignoring it.
- **Requiring properties the site does not have**: a check that is permanently red is no longer of any use. Require only what must always be present.
- **Forgetting changes made outside the repository**: on a CMS, without a scheduled check, a plugin update goes unnoticed.
- **Relying on automation alone**: it checks the form. Truthfulness (prices, reviews, dates) must also be checked; see [align markup with visible content](https://checklist-seo-geo.com/en/schemaorg-structured-data/align-markup-visible-content).

## Frequently asked questions

### Is there an API for Google's Rich Results Test?

No, Google offers no public API for the Rich Results Test, and schema.org offers none for the Schema Markup Validator. To automate, combine a custom script that checks the presence and format of properties, an open source validator such as the one published by Adobe, and Search Console's URL Inspection API, which returns the rich result verdict for the version Google knows, within a limit of 2,000 requests per day per property.

### Should structured data be validated before or after deployment?

Both, if possible. Before deployment, a test in continuous integration blocks a template error before it reaches the site. After deployment, a check on the production URL detects what the test environment does not reproduce: cache, CDN, real data, third-party apps. On a CMS edited from its admin interface, add a scheduled daily check.

### How many URLs should be tested automatically?

Test one URL per template that carries structured data, plus one per special case: product with variants, out-of-stock product, article with several authors, location page. Ten to thirty URLs are enough for most sites, and the check takes a few seconds. To cover every page, also schedule a weekly crawl with structured data validation.

### Does the automated check replace Search Console?

No, the automated check and Search Console complement each other. The script catches a regression a few minutes after deployment, on the chosen URLs. Search Console shows what Google actually crawled and kept across the whole site, and reports issues your tests do not anticipate as well as manual actions. Keep the weekly review of the rich result reports.

## Resources

- [Google Search Central: How structured data works](https://developers.google.com/search/docs/appearance/structured-data/intro-structured-data?hl=en)
- [Google Search Central: URL Inspection API](https://developers.google.com/webmaster-tools/v1/urlInspection.index/inspect)
- [Vercel: GitHub deployments and repository_dispatch events](https://vercel.com/docs/git/vercel-for-github)
- [Vercel: Protection Bypass for Automation](https://vercel.com/docs/deployment-protection/methods-to-bypass-deployment-protection/protection-bypass-automation)
- [Netlify: Create a build plugin](https://docs.netlify.com/extend/develop-and-share/develop-build-plugins/)
- [Adobe: structured-data-validator](https://github.com/adobe/structured-data-validator)
- [Schema.org: Vocabulary files to download](https://schema.org/docs/developers.html)

Next steps: [integrate SEO, performance and accessibility tests into CI/CD](https://checklist-seo-geo.com/en/automation-quality-control/integrate-seo-performance-accessibility-tests-into-ci-cd) and [review template changes](https://checklist-seo-geo.com/en/automation-quality-control/review-template-changes).
