Core Concepts
Seo models search metadata as a deterministic pipeline. Every public page resolves through four ordered layers into a single SeoBag, which is then rendered into <head> HTML, scored out of 100, or serialized to JSON for headless frontends.
The 4-Layer Resolution Cascade
Section titled “The 4-Layer Resolution Cascade”flowchart LR L1["1. Global Singletons\n(seo-settings & seo-identity)"] --> L2["2. Template Rule / Schema\n(seo-mappings & SchemaRegistry)"] L2 --> L3["3. Embedded Page Field\n(@fieldset:seo / metadata)"] L3 --> L4["4. Request Overrides\n($seo->setTitle / jsonLd)"] L4 --> Bag["SeoBag::finalize()\nMeta · Social · JSON-LD · Scripts"]
- Global Singletons (
seo-settingsandseo-identity): Define site-wide defaults ({site_name},{sep}, default title template, fallback description, default social image, robots directive, canonical base URL, environment mode, and Organization/Person Schema.org identity). - Template Rules (
seo-mappings) and Code-First Schemas (SchemaRegistry): Map each ProcessWire template (such aspage,article, oryacht) to token patterns ({title} {sep} {site_name},{summary},{page.parent.title}), fallback image field, Schema.org type, and sitemap priority. - Embedded Page or Entry SEO Field (
@fieldset:seo): AnyFieldtypeEntriesfield configured withembeddedBlueprintType = 'seo'(commonly namedmetadata) allows editors to override title, description, keywords, canonical URL, social image, robots flags, sitemap inclusion, and custom JSON-LD per page. - Request-Scoped Fluent Overrides: Controllers and hooks can call
$seo->setTitle(),setDescription(),setCanonical(),setRobots(),setImage(),setSchemaMode(),setSchemaItems(),setMissingOfferPolicy(), or$seo->jsonLd()->add()before$seo->render($page).
Storage Architecture (SeoBlueprints)
Section titled “Storage Architecture (SeoBlueprints)”Seo stores all configuration, rules, redirects, and 404 logs inside six Entries blueprints with zero custom SQL tables:
| Blueprint Handle | Kind | Purpose |
|---|---|---|
seo |
Embedded Fieldset | Reusable per-page/per-entry SEO fields (@fieldset:seo and FieldtypeEntries embedded mode). |
seo-settings |
Singleton | Global titles, social defaults, analytics/verification scripts, sitemap/redirect toggles, and crawler manifests. |
seo-identity |
Singleton | Organization, LocalBusiness, TravelAgency, or Person Schema.org identity and Creator metadata. |
seo-mappings |
Collection | Per-template metadata token rules, Schema.org defaults, and sitemap policies. |
seo-redirects |
Collection | Exact, wildcard, and regex redirect definitions (301, 302, 307, 308, 410) with hit counters. |
seo-404s |
Collection | Unhandled 404 URL telemetry with hit counts, referrers, and resolution status. |
Name-Agnostic Embedded SEO Fields
Section titled “Name-Agnostic Embedded SEO Fields”Seo never hardcodes a single ProcessWire field name. Your site can name its embedded SEO field metadata, seo, or search_meta, as long as it is a FieldtypeEntries field bound to embeddedBlueprintType = 'seo'. Always resolve fields dynamically via $seo->seoFields(), $seo->resolveTemplateSeoField($template), or $seo->resolvePageSeoField($page).
SeoBag and Its 4 Containers
Section titled “SeoBag and Its 4 Containers”$seo->resolve($page) returns an immutable-ready SeoBag wrapping four specialized containers:
MetaContainer($bag->meta()):<title>, description, keywords, canonical<link>, robots directives,hreflangalternates, site icons, verification tokens, and custom<meta>tags.SocialContainer($bag->social()): Open Graph (og:title,og:description,og:type,og:url,og:image,article:published_time,article:modified_time,og:locale) and X card tags (twitter:card,twitter:site,twitter:title,twitter:description).JsonLdContainer($bag->jsonLd()): Linked Schema.org@graphnodes serialized into<script type="application/ld+json">.ScriptContainer($bag->scripts()): Google Tag Manager (GTM-*), Google Analytics 4 (G-*), Meta Pixel, and customhead,body-open, andbody-closeHTML snippets.
Deterministic 0 to 100 Readiness Score
Section titled “Deterministic 0 to 100 Readiness Score”SeoScoreAnalyzer grades every page from 0 to 100 using five transparent checks (Optimal >= 80, Needs Work 50 to 79, Critical < 50):
| Check | Max Points | What Earns Full Points |
|---|---|---|
| Meta Title | 30 | Unique page or template title between 30 and 60 characters. |
| Meta Description | 30 | Unique page or template description between 110 and 160 characters. |
| Social Share Card | 15 | Absolute https:// social image (recommended 1200x630 px) plus title and description. |
| Structured Data | 10 | Valid JSON-LD @graph with at least one active node and zero syntax errors. |
| Indexing & Canonical | 15 | Valid absolute canonical URL and primary focus keyword present in title or description (when focus keywords are set). |