---
title: "Page title API"
manual: "TYPO3 Explained"
version: "13.4"
permalink: "https://docs.typo3.org/permalink/t3coreapi:pagetitle@13.4"
source: "ApiOverview/Seo/PageTitleApi.rst"
rendered: "2026-09-19T07:17:26+00:00"
---

# Page title API {#pagetitle}

In order to keep setting the page titles in control, you can use the page title
API. The API uses *page title providers* to define the page title based on
page record and the content on the page.

Based on the priority of the providers, the
`\TYPO3\CMS\Core\PageTitle\PageTitleProviderManager` will check the
providers if a title is given by the provider.

Besides the providers shipped by the Core, you can add own providers. An
integrator can define the priority of the providers for his project.

> [!NOTE]
> **See also**
>
> The page title is further influenced by [Properties of 'config'](https://docs.typo3.org/m/typo3/reference-typoscript/13.4/en-us/TopLevelObjects/Config.html#setup-config-pagetitle)
> and [websiteTitle](https://docs.typo3.org/permalink/t3coreapi:sitehandling-basics-websitetitle@13.4).

**Table of contents**

-   [List of page title providers shipped by the Core](https://docs.typo3.org/permalink/t3coreapi:list-of-page-title-providers-shipped-by-the-core@13.4)
-   [Create your own page title provider](https://docs.typo3.org/permalink/t3coreapi:create-your-own-page-title-provider@13.4)
-   [Define the priority of PageTitleProviders](https://docs.typo3.org/permalink/t3coreapi:define-the-priority-of-pagetitleproviders-1@13.4)

## List of page title providers shipped by the Core {#page-title-provider-list}

The TYPO3 Core ships the following page title providers by default, listed from
highest to lowest priority.

### SeoTitlePageTitleProvider {#page-title-provider-seo}

System extension [`typo3/cms-seo`](https://packagist.org/packages/typo3/cms-seo) ships
the `\TYPO3\CMS\Seo\PageTitle\SeoTitlePageTitleProvider`. It is only
available if the extension is installed. It has the identifier `seo`.

When an editor has set a value for the SEO title in the page properties of the
page, this provider will provide that title.

If you have not installed the SEO system
extension, the field and provider are not available.

### RecordPageTitleProvider {#page-title-provider-record}

The fallback provider with the lowest priority is the
`\TYPO3\CMS\Core\PageTitle\RecordPageTitleProvider`. It has the identifier
`record`.

When no other title is set by a provider, this provider will return the title
of the page as defined in the page properties.

## Create your own page title provider {#page-title-provider-custom}

Extension developers may want to have an own provider for page titles. For
example, if you have an extension with records and a detail view, the title of
the page record will not be the correct title. To make sure to display the
correct page title, you have to create your own page title provider. It is
quite easy to create one.

### Example: Set the page title from your extension's controller {#page-title-provider-custom-example}

First, create a PHP class in your extension that implements the
`\TYPO3\CMS\Core\PageTitle\PageTitleProviderInterface`, for example by
extending `\TYPO3\CMS\Core\PageTitle\AbstractPageTitleProvider`.  Within
this method you can create your own logic to define the correct title.

**EXT:my_extension/Classes/PageTitle/MyOwnPageTitleProvider.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MySitepackage\PageTitle;

use TYPO3\CMS\Core\PageTitle\AbstractPageTitleProvider;

final class MyOwnPageTitleProvider extends AbstractPageTitleProvider
{
  public function setTitle(string $title): void
  {
    $this->title = $title;
  }
}

```

Usage example in an [Extbase](https://docs.typo3.org/permalink/t3coreapi:extbase@13.4) controller:

**EXT:my_extension/Classes/Controller/SomeController.php**

```php
<?php

use MyVendor\MySitepackage\PageTitle\MyOwnPageTitleProvider;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

final class SomeController extends ActionController
{
  public function __construct(
    private readonly MyOwnPageTitleProvider $titleProvider,
  ) {}

  public function someAction(): ResponseInterface
  {
    $this->titleProvider->setTitle('Title from controller action');
    // do something
    return $this->htmlResponse();
  }
}

```

Configure the new page title provider in your TypoScript setup:

**EXT:my_sitepackage/Configuration/Sets/MySitepackage/setup.typoscript**

```typoscript
config {
  pageTitleProviders {
    sitepackage {
      provider = MyVendor\MySitepackage\PageTitle\MyOwnPageTitleProvider
      before = record
    }
  }
}

```

### Example: Use values from the site configuration in the page title {#page-title-provider-custom-site-config}

If you want to use data from the [site configuration](https://docs.typo3.org/permalink/t3coreapi:sitehandling@13.4), for
example the site title, you can implement a page title provider as follows:

**EXT:my_sitepackage/Classes/PageTitle/WebsiteTitleProvider.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MySitepackage\PageTitle;

use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
use TYPO3\CMS\Core\PageTitle\PageTitleProviderInterface;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Frontend\Page\PageInformation;

#[Autoconfigure(public: true)]
final readonly class WebsiteTitleProvider implements PageTitleProviderInterface
{
  private ServerRequestInterface $request;

  public function __construct(
    private SiteFinder $siteFinder,
  ) {}

  public function getTitle(): string
  {
    $site = $this->siteFinder->getSiteByPageId($this->getPageInformation()->getId());
    $titles = [
      $this->getPageInformation()->getPageRecord()['title'] ?? '',
      $site->getAttribute('websiteTitle'),
    ];

    return implode(' - ', $titles);
  }

  public function setRequest(ServerRequestInterface $request): void
  {
    $this->request = $request;
  }

  private function getPageInformation(): PageInformation
  {
    $pageInformation = $this->request->getAttribute('frontend.page.information');
    if (!$pageInformation instanceof PageInformation) {
      throw new \Exception('Current frontend page information not available', 1730098625);
    }
    return $pageInformation;
  }
}

```

<!-- TODO: no Markdown rendering for "versionchanged" -->

The frontend.page.information attribute
has been introduced.

The class must be set to [public](https://docs.typo3.org/permalink/t3coreapi:what-to-make-public@13.4), because
we [inject](https://docs.typo3.org/permalink/t3coreapi:dependencyinjection@13.4) the class `SiteFinder` as
dependency.

Then **flush the cache** in **Admin Tools > Maintenance > Flush TYPO3
and PHP Cache**.

Configure the new page title provider to be used in your TypoScript setup:

**EXT:my_sitepackage/Configuration/Sets/MySitepackage/setup.typoscript**

```typoscript
config {
  pageTitleProviders {
    sitepackage {
      provider = MyVendor\MySitepackage\PageTitle\WebsiteTitleProvider
      before = record
      after = seo
    }
  }
}

```

The registered page title providers are called after each other in the
configured order. The first provider that returns a non-empty value is used,
the providers later in the order are ignored.

Therefore our custom provider should be loaded before `record`, the
default provider which always returns a value. If the system extension
[`typo3/cms-seo`](https://packagist.org/packages/typo3/cms-seo) is loaded the default **SEO Title** has a particular format,
you can change this by loading your custom provider before `seo`.

## Define the priority of PageTitleProviders {#define-the-priority-of-pagetitleproviders}

The priority of the providers is set by the TypoScript property
[config.pageTitleProviders](https://docs.typo3.org/m/typo3/reference-typoscript/13.4/en-us/TopLevelObjects/Config.html#confval-config-pagetitleproviders).
This way an integrator is able to set
the priorities for their project and can even have conditions in place.

By default, the Core has the following setup:

**EXT:my_extension/Configuration/Sets/MyExtension/setup.typoscript**

```typoscript
config.pageTitleProviders {
  record {
    provider = TYPO3\CMS\Core\PageTitle\RecordPageTitleProvider
  }
}

```

The sorting of the providers is based on the `before` and
`after` parameters. If you want a provider to be handled before a
specific other provider, just set that provider in the `before`,
do the same with `after`.

If you have installed the system extension SEO, you will also get a second
provider. The configuration will be:

**EXT:my_extension/Configuration/Sets/MyExtension/setup.typoscript**

```typoscript
config.pageTitleProviders {
  record {
    provider = TYPO3\CMS\Core\PageTitle\RecordPageTitleProvider
  }
  seo {
    provider = TYPO3\CMS\Seo\PageTitle\SeoTitlePageTitleProvider
    before = record
  }
}

```

First the `SeoTitlePageTitleProvider` (because it will be handled before
`record`) and, if this providers did not provide a title, the
`RecordPageTitleProvider` will be checked.

You can override these settings within your own installation. You can add as
many providers as you want. Be aware that if a provider returns a non-empty
value, all provider with a lower priority will not be checked.
