Reference: TypoScript helpers
lib.* keys provided by the headless TypoScript. Override any
of them from your site setup to customise the JSON response.
| Key | Purpose |
|---|---|
lib. | Bare PAGE skeleton (JSON headers, cache config, an
empty 10 = JSON). The response page object is
created from it via parse-time copy
(page < lib.) and the fields live on
page. — override those, not the lib. |
lib. | CONTENT_ over tt_ grouped by col.
Referenced by page.. |
lib. | Base JSON shape for every content element. |
| `lib.contentElementWithHeade | lib. plus the standard header block.
Use this as the base for custom CEs that should keep
the title/subtitle/header link block. |
lib. | lib. plus the shared
image-gallery block (image, textpic, textmedia). |
lib. | Legacy SEO meta object (legacy set only) — title,
description, keywords, robots, ogImage. The default
set uses the seo object instead. |
lib. | Per-content-element appearance block: layout
(default/layout-), frame,
space, space. |
lib. | Page-level appearance block: layout
(layout-*) and backend. |
lib. | Menu with special = rootline. |
lib. | sys_ lookup for the current page
(legacy set only). |
lib. | Backend "edit this" link object — attached to the
initial page type (834) for logged-in BE
users only, not to the page response. |
lib. | Recursive content element renderer — used by CEs that contain other CEs (containers, gridelements, etc.). |
Common overrides
Add a top-level field to every page response (the page object is a
parse-time copy of lib., so override page, not the lib):
page.10.fields {
buildId = TEXT
buildId.value = {$myVendor.buildId}
}
Replace the meta object on a specific route — see Overriding the meta object (legacy set).
Make every content element carry a custom field:
lib.contentElement.fields.myField = TEXT
lib.contentElement.fields.myField.field = my_field
Read the shipped TypoScript to see the defaults — every override above just adds to or replaces values inside the same structure.
Files
The default TypoScript lives in
EXT: and is loaded by the site sets
under EXT:. Subdirectories:
Page/—lib.and its children.headless Page Content—Element/ lib.+ per-type CEs (textmedia, bullets, menus, uploads, felogin, …).content Element Helpers/—lib.,render Children lib.. (parse Func_ links lib.andparse Func lib.are provided globally byparse Func_ RTE EXT:since TYPO3 v13.2.)frontend Configuration/— language/backend editor wiring.Legacy/— 4.x-only additions:lib.,meta lib.(page and content element variants) and the full legacycategories pageobject. Loaded by the legacy set, the static template and mixed mode — never by the default set.Page— the trimmed defaultResponse. typoscript pageobject, loaded only by the default set.
The default set
friendsoftypo3/ (label "TYPO3 Headless",
EXT:) ships a trimmed response by
default. The legacy set friendsoftypo3/ (label
"TYPO3 Headless Legacy (4.x)") declares the default set as a dependency and
only loads the Legacy/ delta on top: the full 4.x page object, lib.
and the categories fields. It is the quick upgrade path for existing
installs.
Sites not (yet) on sets can select the equivalent sys_template statics
instead: "Headless" (EXT:, the
trimmed default response), "Headless Legacy (4.x)"
(EXT:, the full 4.x response) and
"Headless - Mixed mode JSON response"
(EXT:). 4.x records keep working
unchanged — the 4.x "Headless" static stored the path that is now registered
as the legacy item, and the mixed static kept its path. Site packages that
@import EXT: directly
also still get the full 4.x response. Note that a root sys_template record
with "Clear" flags wipes all set-provided TypoScript — delete the record when
switching a site to sets.
The default set imports the same lib.* helpers as the legacy setup —
everything in the table above still applies — with two exceptions: lib.
and lib. are not loaded, and lib. does not define
a categories field at all (the legacy delta re-adds it, which restores the
field on every shipped content element at once — all CEs reference
lib. at render time via =<).
Default page response
{
"id": 1,
"type": "Standard",
"slug": "/",
"media": [],
"seo": { "title": "…", "meta": [], "htmlAttrs": {}, "bodyAttrs": {} },
"breadcrumbs": [],
"appearance": { "layout": "layout-0", "backendLayout": "default" },
"content": {},
"i18n": []
}
The seo object is populated at runtime: the TypoScript only ships a
placeholder with seo., which the
After listener detects before handing the
response to the Meta. Do not remove the placeholder — without a
seo. key in the rendered JSON, no seo data is generated at all.
page. (e.g. the generator entry) is likewise still read by the
Meta to build seo..
The additional page types of the legacy setup are available unchanged:
initial (type) and headless_ (type).
Differences to the legacy set
| Removed key | Replacement / how to get it back |
|---|---|
page. | Deprecated duplicate of seo — use seo, which the
Meta fills from the same page properties
(title, description, OpenGraph/Twitter images, …). |
page. | Opt-in; see "Content element categories" in the Configuration chapter (covers page categories too). |
| `lib.contentElement.fields.categorie | Opt-in; same Configuration chapter section. |
plugin. | Not set by this set. Only relevant for third-party extensions probing it to detect headless rendering. |
Every removal saves work on uncached renders: meta cost two extra
Files runs per page, and the categories fields cost one
sys_ join per page respectively per content element — while
returning an empty string unless the storage pid was reconfigured.