▲ SEO Audit for Vercel Preview Deployments
Automatically validate SEO on every Vercel preview deployment before promoting to production.
Vercel creates a unique preview URL for every push. Use a GitHub Actions workflow (or Vercel’s deployment hooks) to run SEODiff validation against the preview URL before promoting to production. Especially useful for Next.js sites where client-side rendering can hide SEO issues.
Configuration
Copy this configuration into your project:
name: Vercel SEO Check
on:
deployment_status:
jobs:
seo-audit:
if: github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
- name: SEODiff Evaluate
env:
PREVIEW_URL: ${{ github.event.deployment_status.target_url }}
run: |
curl -sf -X POST "https://seodiff.io/api/v1/agent/evaluate" \
-H "Authorization: Bearer ${{ secrets.SEODIFF_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{
"urls": ["'"$PREVIEW_URL"'", "'"$PREVIEW_URL"'/blog", "'"$PREVIEW_URL"'/pricing"],
"assertions": [
{"rule": "has_h1"},
{"rule": "has_schema"},
{"rule": "max_js_ghost_ratio", "value": 0.1},
{"rule": "no_noindex"}
],
"wait": true
}' | jq .
# Fail if any assertion fails
STATUS=$(echo "$RESULT" | jq -r '.status')
if [ "$STATUS" = "failed" ]; then
echo "::error::SEO assertions failed on preview deployment"
exit 1
fiSetup Steps
Add API key to GitHub secrets
Your Vercel project triggers GitHub deployments. Add SEODIFF_API_KEY to your repo secrets.
Create the workflow file
This workflow triggers on deployment_status events — Vercel fires these automatically when a preview is ready.
Push to any branch
Vercel deploys the preview, GitHub Actions picks up the deployment URL, SEODiff validates it.
What Gets Checked
The /validate endpoint runs a surface scan and checks for SEO regressions. For deeper testing, combine it with the /agent/evaluate endpoint to add custom assertion rules:
no_placeholders
Find template variables like {{city}} or [TBD] that leaked into production HTML.
max_token_bloat
Detect when boilerplate overwhelms useful content for LLM crawlers.
has_schema
Ensure every page has valid JSON-LD schema markup for rich results.
min_schema_count
Require a minimum number of JSON-LD schema blocks per page.