---
title: "HANDLEBARSTEMPLATE content object"
manual: "Handlebars"
version: "main"
permalink: "https://docs.typo3.org/permalink/cpsit/typo3-handlebars:content-object@main"
source: "Usage/ContentObject.rst"
rendered: "2026-09-29T09:05:57+00:00"
---

# `HANDLEBARSTEMPLATE` content object {#content-object}

`HANDLEBARSTEMPLATE` is a custom content object type provided by
this extension. It compiles and renders a Handlebars template, resolving
template paths, processing variables, and registering assets — all from
TypoScript configuration.

The content object tries to follow the implementation details of TYPO3's
[FLUIDTEMPLATE](https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/ContentObjects/Fluidtemplate/Index.html#cobj-fluidtemplate) content object as closely
as possible. Properties such as `templateName`,
`templateRootPaths`, `variables`,
`settings` and `dataProcessing` work the same way,
including the reserved `data` and `current`
variables. Existing `FLUIDTEMPLATE` configuration can therefore
be reused in most cases. The main difference is that there are no
`layoutRootPaths`, since Handlebars layouts are
[resolved as partials](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:templates-layouts@main).

```typoscript
tt_content.header = HANDLEBARSTEMPLATE
tt_content.header {
    templateName = Header
    templateRootPaths.20 = EXT:my_extension/Resources/Private/Templates
}
```

**Properties**

-   [templateName](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:templatename@main)
-   [format](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:format@main)
-   [template](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:template@main)
-   [file](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:file@main)
-   [templateRootPaths](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:templaterootpaths@main)
-   [partialRootPaths](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:partialrootpaths@main)
-   [variables](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:variables@main)
-   [settings](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:settings@main)
-   [dataProcessing](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:dataprocessing@main)
-   [preProcessing](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:preprocessing@main)
-   [postProcessing](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:postprocessing@main)
-   [assets](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:assets@main)
-   [headerAssets](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:headerassets@main)
-   [footerAssets](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:footerassets@main)
-   [stdWrap](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:stdwrap@main)

---

## templateName {#templatename}

-   ***Type***

    string / stdWrap

-   ***Description***

    Name of the template to render. The value is resolved as a filename
    (without the `.hbs` extension) relative to the configured template
    root paths. Prefix the name with `@` to look up the file by its bare
    filename, see [Referencing templates and partials](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:templates-names@main). Exactly one of
    `templateName`, `template`, or `file`
    must be set.

-   ***Example***

    ```typoscript
    templateName = Header

    # Flat name
    templateName = @header

    # With stdWrap
    templateName.field = tx_myext_template_name
    ```

---

## format {#format}

-   ***Type***

    string / stdWrap

-   ***Description***

    File extension of the template file. If not set, the file extensions
    `hbs`, `handlebars` and `html` are tried in this order.
    Setting a format restricts the lookup to this file extension. It must be
    one of the supported file extensions.

-   ***Example***

    ```typoscript
    format = handlebars
    ```

---

## template {#template}

-   ***Type***

    string / stdWrap

-   ***Description***

    Inline Handlebars source used directly as the template. Useful for short
    or dynamically constructed templates. Cannot be used together with
    `templateName` or `file`.

-   ***Example***

    ```typoscript
    template = <h1>{{header}}</h1>
    ```

---

## file {#file}

-   ***Type***

    string / stdWrap

-   ***Description***

    Absolute or `EXT:`-relative path to a Handlebars template
    file. Cannot be used together with `templateName` or
    `template`.

-   ***Example***

    ```typoscript
    file = EXT:my_extension/Resources/Private/Templates/Special.hbs
    ```

---

## templateRootPaths {#templaterootpaths}

-   ***Type***

    array (numeric keys)

-   ***Description***

    Template root paths for this content object. These are added to the
    content object path provider with the highest priority (100), overriding
    any TypoScript or service container paths for this rendering. Higher
    numeric keys take precedence over lower ones.

-   ***Example***

    ```typoscript
    templateRootPaths {
        10 = EXT:my_extension/Resources/Private/Templates
        20 = EXT:my_other_extension/Resources/Private/Templates
    }
    ```

> [!NOTE]
> The shorthand `templateRootPath` (singular) sets a single
> path at key `0`.

---

## partialRootPaths {#partialrootpaths}

-   ***Type***

    array (numeric keys)

-   ***Description***

    Partial root paths for this content object. Same priority and override
    rules as `templateRootPaths`.

-   ***Example***

    ```typoscript
    partialRootPaths {
        10 = EXT:my_extension/Resources/Private/Partials
    }
    ```

> [!NOTE]
> The shorthand `partialRootPath` (singular) sets a single
> path at key `0`.

---

## variables {#variables}

-   ***Type***

    array

-   ***Description***

    Variables passed to the template. Each entry is processed as a content
    object against the current content element's data record. Simple
    string values are passed through as-is; entries with a sub-array are
    rendered via `ContentObjectRenderer::cObjGetSingle()`.

    Two variable names are reserved and always available automatically:

    -   `data` — the full content element data array
    -   `current` — the current field value

-   ***Example***

    ```typoscript
    variables {
        header = TEXT
        header.field = header

        bodytext = TEXT
        bodytext.field = bodytext
        bodytext.parseFunc =< lib.parseFunc_RTE

        image = FILES
        image.references.fieldName = image

        # Simple variable (no content object rendering)
        wrapperClass = container
    }
    ```

---

## settings {#settings}

-   ***Type***

    array

-   ***Description***

    Arbitrary key-value pairs passed to the template as the `settings`
    variable. Unlike `variables`, entries are not processed as
    content objects — values are used as plain strings.

-   ***Example***

    ```typoscript
    settings {
        showDate = 1
    }
    ```

    In the template:

    ```handlebars
    {{#if settings.showDate}}
        <time>{{date}}</time>
    {{/if}}
    ```

---

## dataProcessing {#dataprocessing}

-   ***Type***

    array

-   ***Description***

    Standard data processors, executed after `variables` are resolved.
    Processors receive and return the `$processedData` array. Any key added
    by a processor is available as a template variable.

    The extension provides additional processors, e.g.
    `process-variables`, `process-each` and
    `media`. See [Data processors](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:data-processors@main) for the complete list.

-   ***Example***

    ```typoscript
    dataProcessing {
        10 = database-query
        10 {
            table = tx_myext_domain_model_item
            as = items
        }

        20 = process-variables
        20 {
            as = items
            merge = 1
            variables {
                label = TEXT
                label.field = title
            }
        }
    }
    ```

---

## preProcessing {#preprocessing}

-   ***Type***

    array

-   ***Description***

    [Data source aware processors](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:developer-corner-data-source-aware-processor@main)
    executed before `variables` are processed. These can read from
    multiple data sources (content element record, processed data, processor
    configuration) and modify the variable set before content object rendering
    begins.

---

## postProcessing {#postprocessing}

-   ***Type***

    array

-   ***Description***

    [Data source aware processors](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:developer-corner-data-source-aware-processor@main)
    executed after `variables` have been resolved and data processors
    have run, but before the template is rendered.

---

## assets {#assets}

-   ***Type***

    array

-   ***Description***

    Registers JavaScript and CSS assets via TYPO3's [Asset collector](https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Assets/Index.html#asset-collector)
    API. Supports four sub-keys: `javaScript`, `inlineJavaScript`,
    `css`, `inlineCss`.

-   ***Example***

    ```typoscript
    assets {
        javaScript {
            my-ext-app {
                source = EXT:my_extension/Resources/Public/JavaScript/app.js
                attributes.defer = 1
                options.useNonce = 1
            }
        }
        css {
            my-ext-styles {
                source = EXT:my_extension/Resources/Public/Css/styles.css
            }
        }
    }
    ```

> [!NOTE]
> **See also**
>
> [Asset management](https://docs.typo3.org/permalink/cpsit/typo3-handlebars:asset-management@main) for the complete assets configuration reference.

---

## headerAssets {#headerassets}

-   ***Type***

    content object

-   ***Description***

    Adds arbitrary markup to the page `<head>`. The value is evaluated
    as a content object and the result is passed to
    `PageRenderer::addHeaderData()`.

-   ***Example***

    ```typoscript
    headerAssets = TEXT
    headerAssets.value = <link rel="stylesheet" href="/assets/styles.css">
    ```

---

## footerAssets {#footerassets}

-   ***Type***

    content object

-   ***Description***

    Adds arbitrary markup before the closing `</body>` tag. The value
    is evaluated as a content object and the result is passed to
    `PageRenderer::addFooterData()`.

-   ***Example***

    ```typoscript
    footerAssets = TEXT
    footerAssets.value = <script src="/assets/app.js"></script>
    ```

---

## stdWrap {#stdwrap}

-   ***Type***

    stdWrap

-   ***Description***

    Standard TYPO3 stdWrap processing applied to the final rendered output.

-   ***Example***

    ```typoscript
    stdWrap.wrap = <div class="handlebars-content">|</div>
    ```
