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. | 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 page meta object (legacy set only): title,
subtitle, abstract, description, keywords,
canonical, robots (no, no),
author, author, og, og,
og, twitter, twitter,
twitter, twitter. The default set uses
the seo object instead. |
lib. | headless- processor
(languages = auto) — the page's i18n list. |
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.). |
lib. | Minimal parse (HTML sanitizer on) that only
resolves <link> and <a> tags through typolink.
lib. and lib. come from
EXT: (globally provided since TYPO3 v13.2). |
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}
}
Override SEO data (seo, or lib. on the legacy set) on a specific
route — see Overriding SEO data on a route.
Make every content element carry a custom field:
lib.contentElement.fields.myField = TEXT
lib.contentElement.fields.myField.field = my_field
The shipped TypoScript shows the defaults; every override above adds to or replaces values inside the same structure.
Files
All TypoScript lives in EXT::
Page/—lib.,headless Page lib.,page Appearance lib..breadcrumbs Content—Element/ lib.,content lib.,content Element lib.,content Element With Header lib.,gallery Content Element lib.and one file per shippedappearance CType.Helpers/—lib.,render Children lib..parse Func_ links Configuration/—lib.,i18n lib., the extra page typesbackend Editor initial(834) andData headless_(835), and the template paths for the felogin, form anddomains EXT:sitemap plugins.seo Logged— conditions adding the logged-in flag andUser/ lib.tobackend Editor initialfor logged-in frontend/backend users.Data Page— the defaultResponse. typoscript pageobject.Legacy/— the 4.x delta:lib.,meta lib., the content elementcategories categoriesfield and a full 4.xpageobject that replaces the default one.Headless/,Mixed/and the rootsetup.— entry points for the sys_template statics (default, mixed and legacy respectively).typoscript
The site sets in EXT: import these: the
default set everything except Legacy/, the legacy set adds Legacy/ on
top, and the mixed set loads Mixed/, which wraps the
legacy-style setup in an Accept header condition (see
Mixed mode and the Accept header).
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
installations.
Sites not (yet) on sets select the equivalent sys_template statics listed in
Configuration. Existing 4.x records keep working unchanged: the 4.x
"Headless" static stored the path that is now registered as the legacy item
(EXT:), the new "Headless" item points at
EXT: (trimmed response), and the
mixed static kept its path (EXT:).
Site packages that @import
EXT: directly also still
get the full 4.x response.
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 seo object
seo is assembled per request by the Meta from the page record, the
EXT: meta tag managers and the TypoScript config., page. and
page. settings:
{
"title": "About us | Example",
"meta": [
{ "name": "description", "content": "…" },
{ "name": "robots", "content": "index,follow" },
{ "property": "og:title", "content": "About us" },
{ "property": "og:image", "content": "https://example.com/fileadmin/…" },
{ "name": "twitter:card", "content": "summary" }
],
"link": [
{ "rel": "canonical", "href": "https://example.com/about" },
{ "rel": "alternate", "hreflang": "en-US", "href": "https://example.com/about" },
{ "rel": "alternate", "hreflang": "de-DE", "href": "https://example.com/de/ueber-uns" }
],
"htmlAttrs": { "lang": "en", "dir": null },
"bodyAttrs": { "class": "pid-12 layout-layout-0" }
}
title— the page title from the corePage;Title Provider Manager config.,page Title Separator config.and custom title providers apply.page Title First meta— one entry per meta tag; the first key isname,propertyorhttp-, as the HTML attribute would be. Sources: the page properties (description, robots, OpenGraph and Twitter fields through theequiv EXT:managers) andseo page.TypoScript with itsmeta.* attribute,httpandEquivalent replaceoptions.link— present only when there is something to link: the canonical URL fromEXT:, and hreflang alternates when the page exists in more than one language.seo html—Attrs langanddir(rtlornull) of the current language, merged withconfig..html Tag. attributes.* body—Attrs classcombiningpid-<uid>and the pageappearance.value, merged with the attributes oflayout page.(values of the same attribute are joined); withbody Tag Add config.aheadless. overwrite Body Tag = 1 bodyattribute replaces a colliding default (e.g.Tag Add class) instead of appending to it.
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 (covers page categories too). |
lib. | Opt-in; same 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.