payload-cms-seo-plugin
v1.0.6
Published
SEO plugin for Payload CMS 3.x — analysis, meta fields, dashboard, redirects, and more
Readme
payload-cms-seo-plugin
SEO plugin for Payload CMS 3.x — analysis, meta fields, dashboard, redirects, and more.
Installation
npm install payload-cms-seo-pluginQuick Start
import { buildConfig } from 'payload'
import { seoPlugin } from 'payload-cms-seo-plugin'
export default buildConfig({
// ... your config
plugins: [
seoPlugin({
collections: ['pages', 'posts'],
siteUrl: 'https://example.com',
}),
],
})Features
| Feature | Default | Description |
|---------|---------|-------------|
| analyzer | ✅ | SEO content analysis with scoring |
| dashboard | ✅ | Admin dashboard with SEO metrics |
| redirects | ✅ | URL redirect management |
| performance | ✅ | Page performance tracking |
| linkGraph | ✅ | Internal link visualization |
| keywords | ✅ | Keyword research tool |
| cannibalization | ✅ | Keyword cannibalization detection |
| schemaBuilder | ✅ | JSON-LD schema generator |
| sitemapAudit | ✅ | Sitemap validation |
| seoLogs | ✅ | SEO activity logging |
| scoreHistory | ✅ | Historical score tracking |
| duplicateContent | ✅ | Duplicate content detection |
| settings | ✅ | Plugin configuration UI |
| aiFeatures | ❌ | AI-powered suggestions |
| gscApi | ❌ | Google Search Console integration |
| indexNow | ❌ | IndexNow API submission |
Configuration
seoPlugin({
collections: ['pages', 'posts'],
globals: ['settings'],
siteUrl: 'https://example.com',
siteName: 'My Site',
uploadsCollection: 'media',
endpointBasePath: '/seo-plugin',
autoCreateMetaFields: true,
features: {
aiFeatures: true,
gscApi: true,
},
thresholds: {
titleLengthMin: 30,
titleLengthMax: 60,
metaDescLengthMin: 120,
metaDescLengthMax: 160,
minWordsGeneric: 300,
minWordsPost: 800,
},
})API Endpoints
All endpoints are prefixed with endpointBasePath (default: /seo-plugin).
| Endpoint | Method | Description |
|----------|--------|-------------|
| /validate | GET | Validate SEO for a document |
| /audit | GET | Full SEO audit |
| /history | GET | Score history |
| /redirects | GET/POST/DELETE | Manage redirects |
| /settings | GET/PATCH | Plugin settings |
| /cannibalization | GET | Detect keyword cannibalization |
| /keyword-research | GET | Keyword research |
| /link-graph | GET | Internal link graph |
| /sitemap-audit | GET | Audit sitemap |
| /schema-generator | GET | Generate JSON-LD schema |
| /performance | GET/POST | Performance metrics |
| /redirect-chains | GET | Detect redirect chains |
| /duplicate-content | GET | Find duplicate content |
| /seo-logs | GET/POST | SEO activity logs |
| /health | GET | Health check |
Frontend Usage
Metadata
import { buildSeoMetadata } from 'payload-cms-seo-plugin/frontend'
export async function generateMetadata({ params }) {
const doc = await payload.findByID({ collection: 'pages', id: params.id })
return buildSeoMetadata({ doc, collection slug: 'pages' })
}JSON-LD
import { buildJsonLd, renderJsonLdScript } from 'payload-cms-seo-plugin/frontend'
export default function Page({ doc }) {
const jsonLd = buildJsonLd({ doc, type: 'Article' })
return (
<>
{renderJsonLdScript(jsonLd)}
{/* page content */}
</>
)
}Peer Dependencies
payload^3.0.0@payloadcms/next^3.0.0@payloadcms/ui^3.0.0react^18.0.0 || ^19.0.0
License
MIT
