payload-seo-geo
Skill0 starsChanged 13 days agoMITView on GitHub
SEO, AEO, and GEO for Payload CMS 3 and Next.js 16 - localized metadata, canonical and hreflang, JSON-LD, sitemaps, robots.txt AI crawler policies, llms.txt, and Summarize with AI links. Use when adding SEO, Open Graph, schema, sitemaps, robots, Search Console verification, llms.txt, or AI citation links.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-guardrailsSkill
- creative-frontendSkill
- figma-handoffSkill
- payload-admin-brandingSkill
- payload-auth-rbacSkill
- payload-bookings-paymentsSkill
- payload-bootstrapSkill
- payload-deploy-vercelSkill
- payload-forms-crmSkill
- payload-integrationsSkill
- payload-legal-trustSkill
- payload-live-previewSkill
- payload-localizationSkill
- payload-mcpSkill
- payload-mediaSkill
- payload-performanceSkill
- payload-project-kickoffSkill
- payload-testingSkill
- project-architectureSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 0 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Every absolute URL uses NEXT_PUBLIC_SERVER_URL: https://, no trailing slash.
- Very specific: line 17
Add the global in references/site-settings.md.
- Very specific: line 36
When searchConsoleVerification is non-empty, the layout metadata includes verification.google.
- Very specific: line 40
Add src/components/JsonLd.tsx and src/utilities/jsonLd.ts from references/json-ld.md.
- Very specific: line 55
Keep next-sitemap.config.cjs and the handlers in src/app/(frontend)/(sitemaps)/.
- Very specific: line 77
Add src/app/llms.txt/route.ts with export const dynamic = 'force-static'.
- Very specific: line 111
Add these rows to PROJECT.md in the cell form from the payload-testing skill.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Payload SEO and GEO
Produces a site-settings global, localized metadata, JSON-LD, sitemap alternates, a robots policy, /llms.txt, and Summarize with AI links.
Every absolute URL uses NEXT_PUBLIC_SERVER_URL: https://, no trailing slash. That is the canonical host. A *.vercel.app host is only acceptable when the client says that host is the public site.
Step 1: Site settings
Add the global in references/site-settings.md. It renders in the locale layout (default title, description, and the Organization or LocalBusiness node), so its hook expires global_site-settings only, with the justification comment in that file.
| Choice | Use |
organization | No public street address |
local-business | Customers visit a real address. Emit LocalBusiness only when street, city, and country are filled |
Access: read for anyone, update for admin and editor (payload-auth-rbac). Group: Settings.
The GDPR badge fields live on this global. Rendering rules are in the payload-legal-trust skill. Default the checkbox to false.
Step 2: Metadata
Follow references/metadata.md.
- In
src/plugins/index.ts, setseoPlugincollectionstopages,posts,legal-pages, andservices, anduploadsCollectiontomedia.generateURLincludes the locale and the collection prefix.generateTitlereturns the document title only. - Extend
src/utilities/generateMeta.ts. Keep an already-absolute media URL absolute. - In
src/app/(frontend)/[locale]/layout.tsx, setmetadataBasefromNEXT_PUBLIC_SERVER_URLandtitle.templateto%s | {siteName}for the active locale. - Each public page sets
alternates.canonicalandalternates.languagesfor every code insrc/i18n/locales.ts, plusx-defaulton the default locale. Open Graph and Twitter usesummary_large_imageand the same title, description, and image. - When
searchConsoleVerificationis non-empty, the layout metadata includesverification.google.
Step 3: JSON-LD
Add src/components/JsonLd.tsx and src/utilities/jsonLd.ts from references/json-ld.md. Serialize with JSON.stringify(data).replaceAll('<', '\\u003c').
Builders: Organization or LocalBusiness, WebSite, BreadcrumbList, BlogPosting, Service, FAQPage, Person. Emit a node only when its required values exist. The locale layout puts Organization and WebSite in one JsonLd, which is the @graph script. Site name, description, logo, and social profile URLs are the fields an admin edits under Settings, Site settings. Do not hardcode them. Name, address, and phone come from that same global.
Checked against Google Search Central on 2026-11-20. Re-open the Search Gallery before telling a client a rich result will show.
| Node | What to expect |
| BlogPosting, BreadcrumbList, Organization, LocalBusiness | Documented rich results when required fields and visible content match |
| FAQPage | FAQ rich results stopped on 7 May 2026, including for government and health sites, and Google removed the FAQ documentation. Emit it only for a visible one-answer FAQ. It still helps answer engines read the page |
| WebSite, Service, Person | No rich-result promise. They name the entity for answer engines |
| HowTo, SearchAction | Do not emit. HowTo rich results and the sitelinks search box are gone |
Step 4: Sitemaps
Keep next-sitemap.config.cjs and the handlers in src/app/(frontend)/(sitemaps)/. Rewrite each <loc> as a locale URL (localePrefix: 'always') and add alternateRefs for every locale plus x-default. Implementation: references/sitemaps-robots-llms.md.
The cache tag stays <collection>-sitemap (sitemapTag from @/utilities/revalidation). Only that collection's targets function expires it. Add legal-pages-sitemap.xml and services-sitemap.xml with the same pattern when those collections exist.
Step 5: Robots and AI crawlers
Store the client's choice on aiCrawlerPolicy. Tokens, sources, and src/app/(frontend)/robots.ts are in references/ai-crawlers.md. Re-read each vendor page linked there before shipping.
| Policy | Behavior |
allow-all | No AI-specific group. User-agent: * disallows /admin |
allow-answer-block-training | Search and user-triggered agents stay allowed. Training tokens are disallowed. Google-Extended also opts out of Gemini grounding, which the client must accept |
block-all | Every verified AI token is disallowed. Googlebot and Applebot stay on the * rule, so Google Search and Apple search stay allowed |
Set generateRobotsTxt: false so public/robots.txt cannot override the CMS policy. A group that names a bot does not inherit the * group, so every group also disallows /admin.
ChatGPT-User and Perplexity-User may ignore robots.txt. Say that to the client. Do not promise those fetches will stop.
Until the client chooses, save allow-all and record that assumption in PROJECT.md.
Step 6: llms.txt
Add src/app/llms.txt/route.ts with export const dynamic = 'force-static'. The format is the llms.txt v2 spec (H1, blockquote, then H2 link lists). One H2 per locale, listing published pages, posts, services, and legal pages as - [title](absolute URL): one line. Titles come from the CMS.
Optional src/app/llms-full.txt/route.ts inlines plaintext of those bodies. Add it only after the client agrees, because it publishes full page text to anyone who fetches it.
In each of those collections' targets functions, append the literal paths /llms.txt and, when the full route exists, /llms-full.txt. Do not pass them through localizedPaths. That costs one or two ISR writes per publish.
In next.config.ts, rewrite /llm.txt, /llms, and /llm to /llms.txt. Leave llms and llm in the src/proxy.ts matcher.
Step 7: Summarize with AI
src/components/SummarizeWithAI.tsx is the only file that knows assistant URLs. Spec and the click-test table: references/summarize.md.
Mount it on pages, posts, and services. Leave it off legal pages. The footer shows a visible line linking to /llms.txt.
Step 8: Answer-first content
Editors follow references/aeo.md on posts and services: a short answer under the title, question headings, a visible author and dates, dateModified, one name/address/phone, and real internal links.
Step 9: Search Console
- The client creates a domain property and pastes the token into
searchConsoleVerification. - Submit
pages-sitemap.xml,posts-sitemap.xml, and the legal and services sitemaps when those routes exist. - Ongoing Search Console data access is configured in
payload-integrations.
Environment
NEXT_PUBLIC_SERVER_URL=https://example.comThe website template already uses this variable. This skill requires it.
Invalidation map
Add these rows to PROJECT.md in the cell form from the payload-testing skill. Keep a single Locales: en, ar line above the table. layout means the global tag only. Do not call revalidatePath with 'layout'.
| Collection or global | Trigger | Paths | Tags | Writes per save |
| site-settings | update | layout | global_site-settings | all routes x locales, rare, accepted |
| pages | publish | /<locale>/<slug>, /llms.txt | pages:<slug>, pages-sitemap | 2 + 1 = 3 |
| posts | publish | /<locale>/posts/<slug>, /<locale>/posts, /llms.txt | posts:<slug>, collection:posts, posts-sitemap | 4 + 1 = 5 |
| services | publish | /<locale>/services/<slug>, /llms.txt | services:<slug>, services-sitemap | 2 + 1 = 3 |
| legal-pages | publish | /<locale>/legal/<slug>, /llms.txt | legal-pages:<slug>, legal-pages-sitemap | 2 + 1 = 3 |
The trace fixtures are trace-page, trace-post, trace-service, and trace-legal, with no category and not featured on the home page, so the hook returns exactly these paths. A page whose slug is home regenerates /<locale> instead of /<locale>/home. Keep that branch in publicPath. Add /llms-full.txt beside /llms.txt only when that route exists. Category or home paths stay off these rows unless the fixture actually renders on those routes.
Detail queries keep <collection>:<docSlug> only. Listing queries keep collection:<slug> only. The hook log line is the check.
Stop and ask
NEXT_PUBLIC_SERVER_URLis missing, or the client has not confirmed the canonical host.- The client has not chosen an AI crawler policy (leave
allow-allonly as a recorded assumption). - They want LocalBusiness and the address, phone, or legal name is incomplete.
- The Arabic Open Graph region (
ar_EG,ar_SA,ar_AE) is not inPROJECT.md. - The Search Console token is not available yet. Ship metadata without the verification tag and add it when they paste it.
- They have not agreed to
/llms-full.txt. - An assistant URL failed the click test.
Done when
- Rich Results Test and Schema Markup Validator accept the home page and a post
- View source on the home page shows one
application/ld+jsonscript whose@graphincludesWebSiteandOrganization, using the site name from Site settings - An admin, signed in, opens Settings then Site settings, changes the site name, logo, or a social URL, saves, and the next view-source shows that change. Sales cannot open the save action
- View source on a post shows
rel="canonical", onehreflangper locale, andhreflang="x-default" curl.exe -s http://localhost:3000/llms.txtprints markdown with one H2 per locale, and/llm.txt,/llms, and/llmreturn that same body with status 200curl.exe -s http://localhost:3000/robots.txtmatches the chosen policy and disallows/adminin every groupcurl.exe -s http://localhost:3000/pages-sitemap.xmlcontains both/en/and/ar/URLs andxhtml:linkalternates- Publishing a post logs that post's paths plus
/llms.txt(and/llms-full.txtwhen present). A site-settings save logsglobal_site-settingsand does not callrevalidatePathwith'layout'
Diagnosis
| Symptom | Cause | Fix |
Canonical host is localhost or vercel.app | NEXT_PUBLIC_SERVER_URL | Step 2 |
JSON-LD name, logo, or sameAs is missing or still a placeholder | Site settings fields are empty, or the layout hardcoded the graph | Settings, Site settings. Rebuild from organizationNode and websiteNode |
Open Graph image URL contains the site host plus https:// | Absolute media URL was prefixed | Metadata reference, image helper |
| Sitemap lists only unprefixed paths | Template URLs were left in place | Step 4 |
Admin policy does not change /robots.txt | public/robots.txt from next-sitemap | generateRobotsTxt: false, then delete that file |
/llms.txt redirects to /en/llms.txt | Proxy matcher | Keep llms and llm excluded |
| A publish regenerates every route | Shared tag, or revalidatePath with 'layout' | Targets reference |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

