← UI Rendering & SSR

UI RENDERING & SSR FEATURE

SEO

Set title, description, and Open Graph tags from your handler without touching Twig templates.

Feature Guide

A quick orientation block that answers the essential questions: what this feature does, how it works, why it matters, and the key concepts behind it.

What this does

Set title, description, and Open Graph tags from your handler — no template hacks needed.

Metadata Control

SEO tags come from the handler

This page sets its own title and social metadata directly in the response resource, not via template overrides.

return $resource
    ->pageTitle('SEO — Semitexa Demo')
    ->seoTag('description', 'Set title, description, and Open Graph tags…')
    ->seoTag('og:title', 'SEO — Semitexa Demo');
Tag Source Value on this page
<title> pageTitle() SEO — Semitexa Demo
description seoTag() Set title, description…
og:title seoTag() SEO — Semitexa Demo
og:description seoTag() Set title, description…
og:type seoTag() website
pageTitle() seoTag() Open Graph description structured data

Verified against Semitexa Ultimate 2026.09.19.1020

SEO

Handlers can set title, Open Graph, and canonical metadata directly without template overrides. SEO tags come from the handler, not from scattered template includes or a global layout config.

How it works

The response resource exposes pageTitle() and seoTag() methods. Call them in the handler and the framework injects the correct <title>, <meta>, and Open Graph tags into the rendered document.

return $resource
    ->pageTitle('SEO — Semitexa Demo')
    ->seoTag('description', 'Set title, description, and Open Graph tags…')
    ->seoTag('og:title', 'SEO — Semitexa Demo')
    ->seoTag('og:description', 'Set title, description, and Open Graph tags…')
    ->seoTag('og:type', 'website');

Key mechanisms

  • pageTitle() — sets the document <title> tag.
  • seoTag() — sets any <meta name> or <meta property> tag by key and value.
  • Open Graph — og:title, og:description, og:type, and any other OG property are declared the same way.
  • Structured data — the same pattern extends to JSON-LD and other structured metadata formats.

Why this matters

Template-level SEO hacks — overriding block variables, injecting strings through config, or writing per-page Twig blocks — make metadata a hidden concern that drifts away from the handler logic that owns the data. Keeping SEO declarations on the response resource means the full-page contract is visible in one place.

© Edsger W. Dijkstra: "Simplicity is prerequisite for reliability."

Handler Application entry point
<?phpdeclare(strict_types=1);namespace App\Application\Handler\Rendering;use App\Application\Payload\Page\SeoPayload;use App\Application\Resource\Page\SeoPageResource;use Semitexa\Core\Attribute\AsPayloadHandler;use Semitexa\Core\Contract\TypedHandlerInterface;#[AsPayloadHandler(payload: SeoPayload::class, resource: SeoPageResource::class)]final class SeoHandler implements TypedHandlerInterface{    public function handle(SeoPayload $payload, SeoPageResource $resource): SeoPageResource    {        return $resource            ->pageTitle('Catalog — Acme Store')            ->seoTag('description', 'Browse the current featured catalog.')            ->seoTag('og:title', 'Catalog — Acme Store')            ->seoTag('og:type', 'website');    }}

Support Semitexa
Built for developers who prefer control over magic. Your support helps keep it fast, open, and evolving.

Donate via PayPal