@consilioweb/payload-seo-analyzer 1.8.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -1
- package/dist/client.cjs +887 -91
- package/dist/client.js +887 -91
- package/dist/index.cjs +1445 -347
- package/dist/index.d.cts +125 -3
- package/dist/index.d.ts +125 -3
- package/dist/index.js +1440 -348
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -631,13 +631,18 @@ All endpoints are prefixed with the configured `endpointBasePath` (default: `/se
|
|
|
631
631
|
| `GET` | `/indexation-audit` | Cross-page indexation hygiene — surfaces every `noindex` / canonical problem in one place |
|
|
632
632
|
| `GET` | `/core-web-vitals` | Real LCP/INP/CLS via PageSpeed Insights — informational, on-demand, SSRF-safe (own origin only) |
|
|
633
633
|
| `GET` `POST` | `/gsc/*` | Google Search Console OAuth (opt-in `features.gscApi`): `status`, `auth`, `callback`, `data`, `disconnect` |
|
|
634
|
+
| `POST` `GET` | `/rank-snapshot` `/rank-history` | Rank tracking (opt-in `features.gscApi`) — daily GSC position snapshots + movement over time |
|
|
635
|
+
| `GET` `POST` | `/alerts-digest` `/alerts-run` | Monitoring digest (opt-in `features.alerts`) — score regressions, new 404s, ranking drops via webhook/email |
|
|
634
636
|
| `GET` | `/history` | Score history data for trend charts |
|
|
635
637
|
| `GET` | `/sitemap-audit` | Sitemap structure audit |
|
|
636
638
|
| `GET` `PATCH` | `/settings` | Read or update SEO settings |
|
|
637
639
|
| `POST` | `/suggest-links` | Internal link suggestions for a page |
|
|
638
640
|
| `POST` | `/create-redirect` | Create a single redirect entry |
|
|
639
641
|
| `GET` `POST` `PATCH` `DELETE` | `/redirects` | Full CRUD for redirect management |
|
|
640
|
-
| `POST` | `/ai-generate` |
|
|
642
|
+
| `POST` | `/ai-generate` | Heuristic meta title/description generation (no API key needed) |
|
|
643
|
+
| `POST` | `/ai-rewrite` | Rewrite a single meta field (Claude if `ANTHROPIC_API_KEY` set, else heuristic) |
|
|
644
|
+
| `POST` | `/ai-optimize` | **AI SEO Optimize** — scan a page, propose optimized meta (Claude Opus 4.8 by default), server-validated; applied in one click from the sidebar |
|
|
645
|
+
| `GET` `POST` | `/alt-text-audit` `/ai-alt-text` | **AI image alt-text** (Claude vision, `features.aiFeatures`) — list images missing alt, generate + apply |
|
|
641
646
|
| `GET` | `/cannibalization` | Detect keyword cannibalization |
|
|
642
647
|
| `POST` | `/external-links` | Check external link status (live HTTP checks with SSRF protection) |
|
|
643
648
|
| `GET` | `/sitemap-config` | Sitemap configuration data |
|
|
@@ -647,6 +652,75 @@ All endpoints are prefixed with the configured `endpointBasePath` (default: `/se
|
|
|
647
652
|
| `GET` | `/link-graph` | Internal link graph data |
|
|
648
653
|
| `GET` `POST` `DELETE` | `/seo-logs` | 404 log management (POST supports secret-header auth) |
|
|
649
654
|
|
|
655
|
+
### AI SEO Optimize (`/ai-optimize`)
|
|
656
|
+
|
|
657
|
+
One-click **"scan → propose → apply"** assistant in the editor sidebar (button **“Optimiser avec l'IA”**):
|
|
658
|
+
|
|
659
|
+
1. Runs the real SEO engine on the current page and collects the failing/warning meta checks.
|
|
660
|
+
2. Sends the content + detected issues to Claude, which proposes an optimized **meta title**, **meta description** and (only when missing) a **focus keyword**, applying the same SEO 2026 rules the engine enforces.
|
|
661
|
+
3. The editor reviews the *current → suggested* diff + rationale and **applies in one click** — the fields are filled, then saved as usual.
|
|
662
|
+
|
|
663
|
+
Scope is **meta only** by design: the SEO 2026 analysis classifies mass AI-generated body content as a spam/penalty risk, so the feature never rewrites page content.
|
|
664
|
+
|
|
665
|
+
**Setup (opt-in, billed to your own Anthropic key):**
|
|
666
|
+
|
|
667
|
+
| Env var | Default | Purpose |
|
|
668
|
+
|---|---|---|
|
|
669
|
+
| `ANTHROPIC_API_KEY` | — | Your Anthropic API key, read **only** server-side (never from the client). **Without it, the feature falls back to the built-in heuristic generators.** |
|
|
670
|
+
| `SEO_AI_MODEL` | `claude-opus-4-8` | Override the Claude model (e.g. `claude-haiku-4-5` for a cheaper/faster option). |
|
|
671
|
+
|
|
672
|
+
The endpoint is gated behind `features.aiFeatures` (default `true`). Suggestions are **validated/clamped server-side** (title ≤ 70, description ≤ 160, focus keyword only filled when empty) so what gets applied is always rule-compliant, regardless of the model's output.
|
|
673
|
+
|
|
674
|
+
### AI image alt-text (`/ai-alt-text`)
|
|
675
|
+
|
|
676
|
+
Generate the `alt` attribute for images that lack one (accessibility + SEO) using **Claude vision**. The Performance view lists media missing alt; for each image you **Generate**, review/edit, then **Apply** in one click. Gated by `features.aiFeatures`; uses `ANTHROPIC_API_KEY` and `SEO_AI_MODEL` (default `claude-opus-4-8`). Images are fetched server-side and must be on the site origin (or `SEO_MEDIA_ORIGIN`) — SSRF-safe.
|
|
677
|
+
|
|
678
|
+
### Rank tracking & monitoring alerts
|
|
679
|
+
|
|
680
|
+
- **Rank tracking** (opt-in `features.gscApi`): once Google Search Console is connected, the plugin snapshots **daily query positions** into `seo-rank-history` and shows **movement over time** in the Performance view. No extra setup beyond GSC.
|
|
681
|
+
- **Monitoring alerts** (opt-in `features.alerts`): a periodic digest (default daily) reports **score regressions**, **new 404s** and **ranking drops** via **webhook and/or email**. Configure delivery with env vars:
|
|
682
|
+
|
|
683
|
+
| Env var | Default | Purpose |
|
|
684
|
+
|---|---|---|
|
|
685
|
+
| `SEO_ALERT_WEBHOOK_URL` | — | POST the digest JSON to this URL (Slack/Discord/automation). |
|
|
686
|
+
| `SEO_ALERT_EMAIL` | — | Comma-separated recipients (uses Payload's email adapter). |
|
|
687
|
+
| `SEO_ALERT_SCORE_DROP` | `10` | Minimum score drop to report. |
|
|
688
|
+
| `SEO_ALERT_POSITION_DROP` | `5` | Minimum SERP positions lost to report. |
|
|
689
|
+
| `SEO_ALERT_INTERVAL_HOURS` | `24` | Digest frequency. |
|
|
690
|
+
|
|
691
|
+
### Frontend render helpers — produce the SEO, not just grade it
|
|
692
|
+
|
|
693
|
+
Pure, dependency-free helpers to output the actual `<head>` metadata + JSON-LD from a Payload document, e.g. in a Next.js route:
|
|
694
|
+
|
|
695
|
+
```ts
|
|
696
|
+
import { buildSeoMetadata, buildJsonLd } from '@consilioweb/payload-seo-analyzer'
|
|
697
|
+
|
|
698
|
+
export async function generateMetadata({ params }) {
|
|
699
|
+
const doc = await payload.findByID({ collection: 'pages', id, depth: 1 })
|
|
700
|
+
return buildSeoMetadata(doc, { collection: 'pages', siteName: 'My Site', siteUrl: 'https://example.com' })
|
|
701
|
+
// → { title, description, alternates: { canonical, languages }, robots, openGraph, twitter }
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
// In a Server Component, render the JSON-LD:
|
|
705
|
+
function PageJsonLd({ doc }) {
|
|
706
|
+
const { jsonLd } = buildJsonLd(doc, { collection: 'pages' })
|
|
707
|
+
return <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }} />
|
|
708
|
+
}
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
`buildSeoMetadata` returns a structural subset of Next's `Metadata` (assignable to it). `buildJsonLd` reuses the exact builders behind the admin schema generator (Article, Product, LocalBusiness, FAQPage, BreadcrumbList, Organization, Person, Event, Recipe, Video). Also exported: `renderJsonLdScript`, `detectSchemaType`, `getSchemaImageUrl`, `SCHEMA_TYPES`.
|
|
712
|
+
|
|
713
|
+
### Low-memory hosting (e.g. Infomaniak)
|
|
714
|
+
|
|
715
|
+
The site-wide audit (`/admin/seo` dashboard) is the heaviest operation. On constrained shared Node hosting it is built **single-flight, in the background**: the first uncached load returns `202` and the dashboard shows a “generating…” state while it computes, then polls until ready — it never blocks or OOM-kills the process. Tune it via env vars if needed:
|
|
716
|
+
|
|
717
|
+
| Env var | Default | Purpose |
|
|
718
|
+
|---|---|---|
|
|
719
|
+
| `SEO_AUDIT_BATCH_SIZE` | `15` | Documents processed per batch. Lower it on very small hosts. |
|
|
720
|
+
| `SEO_AUDIT_MAX_DOCS` | `1500` | Hard cap on documents audited. |
|
|
721
|
+
|
|
722
|
+
For the lowest-memory tiers you can also set `features: { warmCache: false }` to skip the startup/hourly pre-load entirely.
|
|
723
|
+
|
|
650
724
|
<img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" alt="line">
|
|
651
725
|
|
|
652
726
|
## SEO Rules Reference
|