Site settings 

Site settings receive a type, a default value and documentation through site settings definitions.

They are intended for application-level values that vary between sites but are still part of a documented extension contract. A setting is therefore more than a YAML key: the providing set defines what the key means, which type it accepts and which value is safe when an integrator does not configure it.

The extension that introduces a setting MUST also own and provide that definition. Other sets and sites may override the value, but they do not take ownership of the contract.

Using site settings 

Access defined site settings through:

Use them for values that vary by site, such as storage page IDs or feature-specific presentation options.

Storing site setting values 

The site settings editor stores site-specific values in config/sites/<my_site>/settings.yaml. TYPO3 creates the file when it is needed.

For example:

config/sites/my-site/settings.yaml
myExtension.categoryPid: 42
myExtension.detailPagePid: 7
Copied!

TYPO3 still reads the nested-tree representation for backward compatibility. A map can represent foo.bar and foo.bar.baz at the same time, while a YAML tree cannot use foo.bar as both a value and a parent node. The site settings editor also writes defined settings as a map.

Older site configurations may contain an inline settings key in config.yaml. Inline settings and settings.yaml are alternative sources, not two layers: as soon as settings.yaml exists, TYPO3 uses it instead of the inline values.

Store shared values in a set's Configuration/Sets/<my_set>/settings.yaml. The editor does not modify this file. Site-specific values in config/sites/<my_site>/settings.yaml take precedence.

Choosing the right layer 

Where a value belongs depends on who should own it:

Definition default
Use the default in settings.definitions.yaml for the reusable, safe value supplied by the extension. Every defined setting needs this value.
Set override
Use Configuration/Sets/<my_set>/settings.yaml for a preset shared by every site that enables the set. A site package commonly uses this layer to adapt extension defaults to a project.
Site override
Use config/sites/<my_site>/settings.yaml, usually through the site settings editor, when the value belongs to one site.

These layers change the value, not the definition. The definition must come from an active set in all three cases.

How a setting value is resolved 

TYPO3 starts with the definition's default. It then applies values from active sets in resolved dependency order, so a set can adapt a setting from an earlier dependency. Finally, the site-specific value takes precedence:

definition default
  -> active set overrides
    -> config/sites/<my_site>/settings.yaml
Copied!

After composing the effective value, TYPO3 validates and converts it according to the definition. Without a definition, TYPO3 cannot guarantee the identifier, type or fallback value, which is why undefined values must not be used as a new configuration API.

Defining and overriding site settings 

First define the setting in a set that is active for the site:

EXT:my_extension/Configuration/Sets/MySet/settings.definitions.yaml
settings:
  myExtension.categoryPid:
    label: 'Category storage page'
    description: 'Page that stores the category records.'
    type: page
    default: 0
Copied!

Then override the defined setting in the site's settings.yaml:

config/sites/<my_site>/settings.yaml | typo3conf/sites/<my_site>/settings.yaml
myExtension.categoryPid: 658
styles.content.loginform.pid: 23
Copied!

The first setting is owned by the example extension. The second demonstrates that a site may also override a setting defined by another active set; it does not need to repeat that definition.

Accessing site settings in PHP and Fluid 

In PHP you can access the SiteSettings from the Site object via getSettings():

$categoryPid = $site->getSettings()->get('myExtension.categoryPid');
Copied!

See Accessing the current site object for ways to retrieve the site object.

Site settings in Extbase Fluid plugins 

Site settings are not injected automatically into Extbase controllers or plugin settings. Pass them to the plugin through TypoScript or make the site object available in the controller.

To make the site settings available to all templates in your controller you can override method AbstractController::initializeView() and assign the site to the view:

EXT:my_extension/Classes/Controller/ExampleController.php
<?php

declare(strict_types=1);

use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

class ExampleController extends ActionController
{
    public function initializeView(): void
    {
        $this->view->assignMultiple([
            'site' => $this->request->getAttribute('site'),
        ]);
    }

    public function indexAction(): ResponseInterface
    {
        // Variable '{site}' was assigned in initializeView().
        return $this->htmlResponse();
    }
}
Copied!

You can then use the variable {site.settings} to access the site settings:

EXT:my_extension/Resources/Private/Templates/Example/Index.fluid.html
<f:debug>{site.settings.myExtension.categoryPid}</f:debug>
Copied!

Site settings in page TSconfig or TypoScript 

TYPO3 exposes the effective value of a site setting, not its definition. It first composes the default and all applicable overrides as described in How a setting value is resolved. Scalar values are then added to the TypoScript constants with exactly the same identifier as the setting.

The definition remains the contract behind that value. Its metadata, such as label, description and type, is not available as TypoScript. Consequently, TypoScript should only read identifiers whose definitions are provided by an active set. Anonymous values may still be exposed for backward compatibility, but they are not a supported configuration API.

Pass a setting to TypoScript 

This example passes a page ID from a site setting to an Extbase plugin. The extension has already defined myExtension.categoryPid and the site has overridden it to 658 in Defining and overriding site settings.

After TYPO3 has resolved the setting, the identifier is available as the TypoScript constant {$myExtension.categoryPid} . It can be assigned to any scalar TypoScript property:

EXT:my_extension/Configuration/Sets/MySet/setup.typoscript
plugin.tx_myextension.settings.categoryPid = {$myExtension.categoryPid}
Copied!

With the site override above, the parsed value of plugin.tx_myextension.settings.categoryPid is 658. If the site does not override it, the definition's default value 0 is used. A default in constants.typoscript with the same identifier does not win: every defined setting already supplies a value and overrides typoscript constants.

The same constant is available in page TSconfig. This makes one defined setting usable by both frontend rendering and backend form configuration:

// store tx_ext_data records on the given storage page by default (e.g. through IRRE)
TCAdefaults.tx_ext_data.pid = {$myExtension.categoryPid}

// load category selection for plugin from our dedicated storage page
TCEFORM.tt_content.pi_flexform.ext_pi1.sDEF.categories.PAGE_TSCONFIG_ID = {$myExtension.categoryPid}
Copied!

Read a setting with the TypoScript data function 

In frontend TypoScript, a content object can read the setting directly from the current site instead of using constant substitution:

lib.categoryPid = TEXT
lib.categoryPid {
    data = siteSettings:myExtension.categoryPid
}
Copied!

Use {$myExtension.categoryPid} when a value must be inserted into the TypoScript configuration while it is parsed, or when it is needed in page TSconfig. Use data = siteSettings:myExtension.categoryPid when a frontend content object supports the data function and should read from the current site at runtime. Both forms use the exact, case-sensitive setting identifier.

When a page is rendered with PAGEVIEW, the complete resolved TypoScript settings tree is available in Fluid as {settings} . Site settings therefore appear under their dotted path, for example {settings.myExtension.categoryPid} . This variable contains all TypoScript settings, however, not only Site Settings. A later value from the site's constants.typoscript or a sys_template record can differ from the value returned by $site->getSettings() .

Avoid common pitfalls 

Installed does not mean active
Installing the providing extension makes its set available, but the definition contributes to a site only when that site activates the set directly or through a dependency. If a constant is not substituted, first check the site's dependencies in config.yaml.
Constants are text substitutions
Site settings are validated and converted according to their definition, but a TypoScript constant is inserted as source text. The original PHP type does not survive constant substitution. In particular, a Boolean true becomes 1 and false becomes an empty value. Use the value in a context that applies the expected TypoScript type conversion.
Lists are not single constants
A setting of type stringlist is an array. TYPO3 exposes its scalar entries as flattened constants such as {$myExtension.allowedHosts.0} ; it does not create one usable {$myExtension.allowedHosts} value for the complete list. Read structured settings through the Site Settings API in PHP or Fluid instead of depending on numeric constant names.
Multiline values are not safe constant values
TYPO3 generates one constant assignment per scalar setting. A line break in a text value therefore becomes a line break in the generated TypoScript source. Read multiline content directly through the Site Settings API rather than substituting it as a constant.
Identifiers are exact
{$myextension.categoryPid} and {$myExtension.categoryPid} are different constants. Keep the vendor or extension prefix and casing consistent in the definition, all overrides and every consumer.
Dotted paths do not define their parents
A definition for myExtension.features.preview does not also define myExtension.features or myExtension. Each identifier that forms part of the public configuration API needs its own definition. Conversely, the map representation in settings.yaml allows separately defined foo.bar and foo.bar.baz to coexist.

Know which value wins 

Within a site TypoScript provider, TYPO3 loads set constants first, then adds the effective site settings as constants, followed by the site's own constants.typoscript. Constants from sys_template records are applied afterwards. A later value with the same identifier overrides an earlier one.