Skip to content

Templating & Overrides

In ProcessWire templates (site/templates/*.php), Seo is available directly via $seo (or wire()->seo). All rendering and fluent override methods accept either a Page or an Entries EntryItem.

<?php
declare(strict_types=1);
namespace ProcessWire;
/** @var Page $page */
/** @var Seo $seo */
$seo = wire()->seo;
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<?= $seo->render($page) ?>
</head>
<body>
<?= $seo->renderBodyOpen($page) ?>
<main><!-- Page content --></main>
<?= $seo->renderBodyClose($page) ?>
</body>
</html>

If your layout places <head> analytics scripts in a different partial than meta tags, pass includeHeadScripts: false to avoid emitting scripts twice:

<?php
declare(strict_types=1);
namespace ProcessWire;
echo $seo->render($page, includeHeadScripts: false);
// Later in <head>:
echo $seo->renderScripts('head', $page);

Call fluent setters before $seo->render($page) to adjust metadata dynamically for virtual routes, paginated listings, search results, or detail views:

<?php
declare(strict_types=1);
namespace ProcessWire;
use Totoglu\Seo\Schema\MissingOfferPolicy;
/** @var Page $page */
/** @var Pages $pages */
/** @var Seo $seo */
$seo = wire()->seo;
$yachts = $pages->find('template=yacht, sort=sort, limit=24');
$seo->setTitle('2026 Private Yacht Fleet | Aegean Voyages')
->setDescription('Browse 24 crewed Turkish gulets and catamarans available for weekly charter from Gocek and Bodrum.')
->setCanonical($page->httpUrl)
->setRobots(noIndex: false, noFollow: false)
->setImage('https://aegeanvoyages.example/site/assets/files/1024/fleet-og.jpg')
->setSchemaMode('list')
->setSchemaItems($yachts)
->setSchemaMeta(['region' => 'Aegean'])
->setMissingOfferPolicy(MissingOfferPolicy::Fallback)
->jsonLd()
->add([
'@type' => 'TouristTrip',
'name' => 'Gocek 12 Islands 7-Day Voyage',
]);
echo $seo->render($page);

When rendering an Inertia/React frontend or custom JSON response, call $seo->resolve($page) or $seo->toArray($page):

<?php
declare(strict_types=1);
namespace ProcessWire;
$bag = $seo->resolve($page);
// Access individual containers
$resolvedTitle = $bag->meta()->getTitle();
$ogImage = $bag->social()->getImageUrl();
$graphNodes = $bag->jsonLd()->graph();
$diagnostics = $bag->schemaDiagnostics();
// Or serialize everything to an associative array
$payload = $seo->toArray($page);

Multi-Language Templates (LanguageSupport)

Section titled “Multi-Language Templates (LanguageSupport)”

When LanguageSupport and LanguageSupportPageNames are active, SeoResolver automatically resolves:

  • Localized meta_title, meta_description, og_title, og_description, and site_name for the active $user->language (with inheritLanguage fallback).
  • Canonical URLs normalized with canonical_base_url and trailing_slash_policy.
  • <link rel="alternate" hreflang="..."> tags for every active guest-viewable language plus x-default.
  • og:locale and og:locale:alternate tags derived from each language’s BCP-47 code.

Next steps