Skip to content

Template Rules & Page Editor

Instead of manually typing meta tags on hundreds of pages, define Template Rules (seo-mappings) once per ProcessWire template and reserve per-page overrides in the Page SEO Editor for high-value landing pages and editorial tweaks.

Open Setup -> SEO -> Template Rules to view every eligible frontend template, verify whether an embedded SEO field is attached, and edit default metadata patterns.

Template Rules shows which frontend templates carry an embedded SEO field (metadata) and controls their default Schema type and XML sitemap inclusion.

Click Sync Templates (or run php vendor/bin/wire seo:setup --all-templates) to create default rules for new templates and prune rules for removed templates. Each Template Rule has three tabs:

  1. General & Templates (tab_general):
    • title & target_name: Human label and exact ProcessWire template name (for example, page, article, yacht).
    • title_template & description_template: Tokenized strings interpolated by TokenInterpolator. Supported tokens include {title}, {headline}, {summary}, {site_name}, {sep}, {page.parent.title}, or any scalar field name on the page.
    • image_field: Fallback image (or Media) field name on the page used for Open Graph, Schema.org, and <image:image> sitemap entries when og_image is blank.
  2. Schema & Social (tab_schema):
    • schema_type: WebPage, Article, NewsArticle, BlogPosting, Product, Service, Event, FAQPage, AboutPage, ContactPage, CollectionPage, ItemPage, or None.
    • og_type: website, article, product, or profile.
    • Conditional Product Fields (schema_type=Product): schema_price_field, schema_currency (enriched automatically when Currency is installed), schema_sku_field, and schema_availability.
    • Conditional Event Fields (schema_type=Event): schema_event_start_field, schema_event_end_field, and schema_event_location.
  3. Indexing & Sitemap (tab_indexing):
    • robots_noindex: Default noindex toggle for matching pages.
    • sitemap_enabled, sitemap_priority (0.1 to 1.0), sitemap_changefreq (always to never), and sitemap_images.

The 4-Tab Page SEO Editor (./page/?id={id})

Section titled “The 4-Tab Page SEO Editor (./page/?id={id})”

Click Edit SEO on any row in Content SEO (or open ./page/?id={id} directly) to edit a page’s embedded @fieldset:seo fields alongside real-time previews and Prev / Next page navigation.

The 4-tab Page SEO Editor supports multi-language overrides, live character counters, fallback placeholders, and instant navigation between pages.

Each page’s embedded SEO field stores:

  • General: meta_title (max 70 chars), meta_keywords (comma-separated focus keywords), meta_description (max 160 chars), canonical_url (InputfieldReactLink supporting Page picker or Custom URL with query/anchor), robots_noindex, and robots_nofollow.
  • Social: og_image (1200x630 with focal point and Media library picker), og_title, og_description, og_type, and twitter_card.
  • Schema & Sitemap: schema_type (or Inherit), sitemap_include (inherit, include, exclude), sitemap_priority, and schema_custom_json.
  • Advanced: extra_meta key/value custom <meta> tags (overrides global tags with the same name) and read-only indexed seo_score.

Discovering & Attaching Embedded SEO Fields in PHP

Section titled “Discovering & Attaching Embedded SEO Fields in PHP”

Never assume the field is always named 'seo'. Use Seo’s name-agnostic helpers:

<?php
declare(strict_types=1);
namespace ProcessWire;
/** @var Seo $seo */
$seo = wire()->seo;
// Discover all FieldtypeEntries fields bound to embeddedBlueprintType = 'seo'
$fields = $seo->seoFields();
// Attach (or create) an embedded 'metadata' field on the 'yacht' template
$field = $seo->attachSeoFieldToTemplate('yacht', 'metadata');
// Resolve the active SEO field for a specific page
$pageSeoField = $seo->resolvePageSeoField($page);

SeoScoreAnalyzer computes scores deterministically from the resolved SeoBag:

  • Optimal (80 to 100): Unique title (30 to 60 chars), unique description (110 to 160 chars), absolute social image, valid JSON-LD, and valid canonical URL with primary focus keyword alignment.
  • Needs Work (50 to 79): Typically caused by relying on global fallback descriptions, short/long titles, missing social share images, or a focus keyword missing from title/description.
  • Critical (0 to 49): Empty title or description, missing/invalid canonical URL, or invalid custom JSON-LD syntax.

On multi-language sites, SeoScoreAnalyzer::findMissingLanguageWarnings($page) also flags pages that have translated content but are missing localized SEO titles or descriptions.

Next steps