Skip to content
Marketing Factory Digital GmbH
Contact
Logo Marketing Factory Digital GmbH
  • Agency
    • About us
    • History
  • Services
    • Consulting, Analysis and Strategy
    • Programming and Development
      • Interface Development
      • PIM/ERP Links
      • Custom Development
      • Seamless CMS Integration
    • Hosting and Support
      • Operation on our Colocation Hardware
      • Cloud Strategies
    • Services with Third Parties
  • Technology
    • TYPO3
      • Current TYPO3 Versions
    • Shopware
    • IT Security
      • DDoS Protection
      • Continuous Upgrading
      • Privacy First
    • Tech Stack
      • Commitment to Open Source
      • Technology Selection
      • PHP Ecosystem
      • Containerisation & Clustering
      • Content Delivery Networks
      • Search Technologies
  • References
    • Projects
    • Clients
      • Client List
    • Screenshot of the homepage of the new Maxion Wheels websiteNEW: Relaunch of the corporate website of Maxion Wheels
  • Community
    • Community Initiatives
  • Blog
  • Contact
  • Deutsch
  • English

You are here:

  1. Blog
  2. How to include all Static Templates with your TYPO3 sitepackage
TYPO3 Logo
  • Development
  • TYPO3
  • Tutorial
26.02.2019 Last updated: 16.01.2025

How to include all Static Templates with your TYPO3 sitepackage


Show larger version for: Static Includes in the Template record: long list on both sided

What are Static Templates in TYPO3?

Static templates are TypoScript files that contain specific configurations. They are used, for example, to extend the appearance or behavior of an extension in TYPO3. To integrate these configurations into TYPO3, they have to be included via a template.

In practice, the whole thing usually looks something like this:

It is almost impossible not to get confused. The integration of the static templates often has to happen in a certain order, because the individual templates build on each other and therefore depend on each other.

Alternative with TYPO3 v13 and higher: Site sets

Update 01/2025: Since TYPO3 v13 the new "Site sets" feature is available. You can use Site sets to include TypoScript, Page TSconfig, and other settings in a website in a whole new way. A Site set is applied via the Site Configuration. As the rootPageId is defined there, the assignment to the site is done automatically. The template record on the root page can therefore be omitted and the static includes are no longer required.

Extensions can also provide Site sets, which you can add as a dependency in your configuration file. If individual extensions do not yet offer a Site set, you can still integrate their TypoScript as described below.

The official TYPO3 sitepackage tutorial shows how Site sets can be used in practice.

We recommend that you set up new projects directly with Site sets. Existing projects can also be migrated anytime after the upgrade to TYPO3 v13.

Why do we include Static Templates via the sitepackage and not via the template record in TYPO3?

We at Marketing Factory work with the versioning system Git. Often enough, multiple employees will work on the same project but in different branches.

If one of the employees were to add an extension with a Static Template, every other employee would also have to adapt the static templates in their local development environment, when switching to the same branch. The same issue would also occur if the branch is deployed to a testing or staging system and another branch was previously deployed there.

Ergo: Unnecessary, multiple effort, as well as increased documentation requirements.

Show larger version for: TypoScript directory structure in sitepackage

How do we include all Static Templates with the sitepackage?

Update 01/2023: in the original blog post, we had loaded the includes in two separate TypoScript files. The new examples show our current way of working. We also removed the old include syntax of TYPO3 v8 from this tutorial.

The two files constants.typoscript and setup.typoscript are provided by the addStaticFile() method in our Sitepackage. Please refer to the official TYPO3 documentation for more details.

Depending on the project, the directory structure will look something like this:

constants.typoscript

//
// Dependencies
// ------------------------------------------
@import 'EXT:bootstrap_package/Configuration/TypoScript/constants.typoscript'
@import 'EXT:blog/Configuration/TypoScript/Integration/constants.typoscript'
@import 'EXT:picturecredits/Configuration/TypoScript/constants.typoscript'
@import 'EXT:sg_cookie_optin/Configuration/TypoScript/Frontend/constants.typoscript'
@import 'EXT:bw_captcha/Configuration/TypoScript/constants.typoscript'
@import 'EXT:solr/Configuration/TypoScript/Solr/constants.typoscript'


//
// Project setup
// ------------------------------------------
@import 'EXT:project_sitepackage/Configuration/TypoScript/Constants/*.typoscript'

setup.typoscript

//
// Dependencies
// ------------------------------------------
@import 'EXT:bootstrap_package/Configuration/TypoScript/setup.typoscript'
@import 'EXT:blog/Configuration/TypoScript/Integration/setup.typoscript'
@import "EXT:typo3_encore/Configuration/TypoScript/setup.typoscript"
@import 'EXT:picturecredits/Configuration/TypoScript/setup.typoscript'
@import 'EXT:form_element_linked_checkbox/Configuration/TypoScript/setup.typoscript'
@import 'EXT:sg_cookie_optin/Configuration/TypoScript/Frontend/setup.typoscript'
@import 'EXT:bw_captcha/Configuration/TypoScript/setup.typoscript'
@import 'EXT:solr/Configuration/TypoScript/Solr/setup.typoscript'
@import 'EXT:yoast_seo/Configuration/TypoScript/setup.typoscript'


//
// Project setup
// ------------------------------------------
// Elements
@import 'EXT:project_sitepackage/Configuration/TypoScript/Elements/01_Configuration.typoscript'
@import 'EXT:project_sitepackage/Configuration/TypoScript/Elements/02_Plugin.typoscript'
@import 'EXT:project_sitepackage/Configuration/TypoScript/Elements/10_PageTemplate.typoscript'

// Content Elements
@import 'EXT:project_sitepackage/Configuration/TypoScript/ContentElements/Helper/*.typoscript'
@import 'EXT:project_sitepackage/Configuration/TypoScript/ContentElements/*.typoscript'

// Extensions
@import 'EXT:project_sitepackage/Configuration/TypoScript/Extensions/*.typoscript'

Both in the TypoScript constants and the setup, we first include all extensions that are required in the project. These can be third-party extensions, but also project-specific custom developments.

Only then do we include the other, individual configurations from the sitepackage:

  • overwriting TS constants from third-party extensions
  • project-specific basic configurations
  • configuration of custom (content) elements
  • modification or addition of extension configurations
  • the PAGE setup (or overrides of an existing PAGE object, if you use solutions like the Bootstrap Package)
Show larger version for: Static Includes in Template record: only the sitepackage is included afterwards

At the end, only the Static Template of the sitepackage has to be loaded in the template record of TYPO3.

Et voilá: Instead of having to manage a complex, sequential sequence, all static templates can simply be included in one step.

Christian Hellmund
Get blog posts as RSS feed

Related blog posts

  • User-friendly customization of the TYPO3 backend
  • Improving TYPO3 Container elements
  • Automatic updates in our projects
  • Relaunch of the website of our client Maxion Wheels based on TYPO3 12.4 LTS

Please feel free to share this article.


Comments

No comments yet.

Write a comment.

I have been informed that the processing of my data is on a voluntary basis and that I can refuse my consent without detrimental consequences for me or withdraw my consent at any time to Marketing Factory Digital GmbH by mail (Marienstraße 14, D-40212 Düsseldorf) or e-mail (info@marketing-factory.de).

I understand that the above data will be stored for as long as I wish to be contacted by Marketing Factory. After my revocation my data will be deleted. Further storage may take place in individual cases if this is required by law.

  • Data privacy policy
  • Legal notice

© Marketing Factory Digital GmbH

Picture Credits
  1. "TYPO3 Logo": TYPO3 Association
  2. "Static Includes in the Template record": © Creator Marketing Factory Digital GmbH
  3. "TypoScript directory structure in sitepackage": © Creator Marketing Factory Digital GmbH
  4. "Static Includes in Template record: sitepackage only": © Creator Marketing Factory Digital GmbH