Instatic
Instatic copied to clipboard
feat(seo): SEO & AEO workspace — metadata model, JSON-LD, robots/sitemap, AI suggestions
What changed
SEO & AEO as a core publishing capability, end to end:
Core model (src/core/seo/, new barrel-gated engine module)
- Structured
SeoMetadatastored incells_json.seo(one built-inseoMetadatafield onpage/postTypetables — replaces the flatseoTitle/seoDescriptionfields, no compat path; pre-release). SiteSeoSettingsundersite.settings.seo(title pattern, description, default social image, X handle/card, Organization, robots, sitemap) — replaces the legacymetaTitle/metaDescriptionsettings.- One shared resolver with two-stage title resolution (explicit title →
{source.field}token pattern via the existing token engine → base title → site name), used identically by the publisher, the admin previews, and the health indicators.
Published output
- New
src/core/publisher/seoHead.ts: title, description, canonical,noindex(never a silentnofollow), Open Graph (incl.og:locale,og:site_name,article:*_time), X cards, and schema.org JSON-LD (WebSite,Organization,Article,BreadcrumbList) with safe serialization. - Absolute URLs come only from the configured
PUBLIC_ORIGINS— baked HTML never guesses a host; dynamic endpoints fall back to the request origin.
Crawl files
- First-party
GET /robots.txtandGET /sitemap.xml(server/publish/seoEndpoints.ts), dispatched before static assets/public rendering, generated from the published snapshot and cached perpublishVersion. - Robots.txt carries two AI-crawler toggles: training bots (GPTBot, Google-Extended, CCBot, Applebot-Extended, meta-externalagent) and answer bots (OAI-SearchBot, PerplexityBot, ChatGPT-User, Claude-SearchBot).
Admin workspace (/admin/tools/seo)
- New Tools nav dropdown (SEO + plugin admin pages; plugin routes unchanged).
- Meta tab: target index (search, filters, issue chips, health dots, keyboard nav, pinned Site defaults) + sticky preview editor with Search/OG/X/Schema views, inherited values as placeholders, pixel length meters, media-library image pickers, customize-X gate, dirty-switch guard dialog.
- Robots.txt tab: toggles over a byte-identical generated preview. Sitemap tab: enable/exclusions with counts.
- AI suggestions: sparkle on metadata inputs →
POST /seo/generate(one tool-less call through the existingserver/aidriver stack) → three tappable bubbles with More options / Reject.
API & permissions
/admin/api/cms/seo/*route group; newseo.read/seo.managecapabilities; target writes additionally enforce the owning persona (pages.edit/ content edit); generate additionally requiresai.chat.
Why
SEO/AEO correctness belongs in the CMS core: metadata emission, structured data, crawl files, and answer-engine controls must work without plugins. Spec was reviewed and hardened first (fallback-chain correctness, publish-lifecycle integration, origin handling, AEO scope).
Impact
- Local dev DBs need re-seeding (
rm -rf .tmp/dev.dbor freshbun run dev) — the seeded built-in field set changed. site.settings.metaTitle/metaDescriptionare gone; site-wide SEO copy lives in the SEO workspace.- 38 core capabilities (was 36); Owner/Admin gain
seo.*automatically.
Verification
bun test # 5438 pass, 0 fail
bun run build # tsc -b && vite build — clean
bun run lint # clean
🤖 Generated with Claude Code