Skip to Main Content

Site Sets - The evolution of TYPO3 con­fig­ur­a­tion

The minimum requirements for configuration management should always include the following points: Reliability and Validability. The Site Configuration introduced with TYPO3 9 LTS has implemented these requirements. Configurations are stored in files that can be easily versioned in version control. The Site Configuration module validates the entered values for strict typing and sets default values where necessary.

The Site Sets introduced with TYPO3 13 LTS add another important component: Reusability. After all, who hasn't been frustrated about having to repeat a task that's already been completed over and over again?

Reorganized configuration structure in TYPO3

Site Sets in Theory

Site Sets are a "wrapper" for all site settings, TypoScript, and TSConfig configurations needed within the scope of a single website. They can also be flexibly extended with additional settings for active content elements. Since Site Sets can be reused at will, they are particularly useful in multi-domain projects. Essentially, they bundle all available configurations of an extension in the Configuration/Sets/MyExtension folder.

This folder serves as a "container" for all settings (Settings, TypoScript, TSConfig, and activated content elements) of the respective extension. The "Sets" are integrated as dependencies via the page configuration and are automatically loaded, sorted, and any duplications are removed. The classic templating via sys_template or @import of TypoScript files is no longer necessary.

Conceptually, "Site Sets" (which are typically configured in the template provider extension) can be distinguished from "Sub Sets" (which are provided by third-party extensions). These are configuration packages that exclusively represent the configuration of their extension and are included by the Site Sets.

For all configuration packages, the achievements of Site Configuration can be utilized, and strict typing can be used. This means only values that match the definition are accepted, and there is a fallback to defined default values when settings are not configured. As a result, all active settings including fallbacks are directly provided as TypoScript constants and Fluid variables. The sets with default settings can be used on multiple pages simultaneously, while the settings can be overridden in the respective page configurations at any time. A clear UI in the backend has also been developed for this purpose.

Site Sets in Practice

We explain the use of Site Sets and Settings using our provider extension f7templates, which we use to provide templates and define page configuration. Here we have created a comprehensive set that bundles the most common configurations:

Set definition of our provider extension

Set Definition of our Provider Extension

When we look at the config.yaml, the Dependencies are particularly interesting, as we use them to centrally control the integration of other extensions. Only extensions defined here are available on the respective site. This means we can, for example, install a large package of our own content elements but activate them only for individual sites.

 

name: f7/f7templates
label: F7 Templates
dependencies:
  # Basics
  - f7/f7base
  - f7/f7elements
  # Content Blocks
  - f7/f7slider
  - f7/f7teaser
  # Extensions
  - f7/f7events
  - f7/f7forms
  - f7/f7seo

f7templates/Configuration/Sets/F7templates/config.yaml

Additionally, we prepare some definitions with default values via the settings.definitions.yaml that can later be configured individually per page:

 

categories:
 f7.f7templates:	
   label: 'Template'
   parent: f7
settings:
 f7.theme.copyright:
   category: f7.f7templates
   label: 'Copyright'
   description: 'Copyright information that is displayed in the footer, for example.'
   type: string
   default: ''
 f7.theme.navigation.footer:
   category: f7.f7templates
   label: 'Footer Navigation'
   description: 'Comma separated list of page IDs for footer navigation'
   type: string
   default: ''
 f7.theme.navigation.meta:
   category: f7.f7templates
   label: 'Meta Navigation'
   description: 'Comma separated list of page IDs for meta navigation'
   type: string
   default: ''

f7templates/Configuration/Sets/F7templates/settings.definitions.yaml

Now we have created the foundation for other extensions to be integrated and basic settings to be provided via the set "f7/f7templates".

How are our configurations integrated into the page and thus activated?

For this, the dependency for our provider set must be integrated into the page properties. This then automatically loads all further configurations, sorts them, removes duplicates, and provides the settings as constants.

 

base: '%env(ENVIRONMENT_URL_1)%'
dependencies:
 - f7/f7templates
errorHandling:
 - errorCode: 404
   errorHandler: Page
   errorContentSource: 't3://page?uid=2'

config/sites/mysite/settings.yaml

Where do I set the values for my page settings?

Auch dies erfolgt zentral über die Seitendefinition. Hier können alle Werte überschrieben werden, die nicht dem Fallback entsprechen.

 

f7:
 theme:
   color: '#00447c'
   copyright: 'F7 Media GmbH - Mission Discovery'
   navigation:
     footer: '3,4'
     meta: '18,19'

config/sites/mysite/settings.yaml

Outlook: Presets and Themes

With the introduction of Site Sets in TYPO3, website configuration is elevated to a new level. Site Sets enable developers to define "Presets" - pre-made configurations that can be effortlessly applied to different projects. These presets bundle central settings such as layouts, content elements, design templates, and even extensions. This enables pre-made templates similar to WordPress themes. Some examples of this were developed at TYPO3 Surfcamp 2024, such as the Corprorate Preset.

Thus, Site Sets are a major step towards making TYPO3 more economical, efficient, and clearer.

Acknowledgment

Many thanks to Ben Franzke for his excellent presentation at TYPO3 Developer Days 2024 and permission to use excerpts from his slide set for this article.