> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ghost.org/llms.txt
> Use this file to discover all available pages before exploring further.

# block

> Usage: `{{{block "section"}}}` and `{{#contentFor "section"}} content {{/contentFor}}`

***

`{{{block "block-name"}}}` is a helper for creating a placeholder within a custom handlebars template. Adding the helper along with a unique ID creates a slot within the template, which can be optionally filled when the template is inherited by another template file.

The `{{#contentFor "block-name"}}...{{/contentFor}}` helper is used to access and populate the block definitions within the template that’s being inherited. The inherited template is referenced with `{{!< template-name}}` at the top of the file. If the `contentFor` is not used then the block will be gracefully skipped.

### Example

```handlebars theme={"dark"}
<!-- default.hbs -->

<body>
    <!-- ... -->
    {{{block "scripts"}}}
</body>
```

***

```handlebars theme={"dark"}
<!-- page.hbs -->

{{!< default}}

{{#contentFor "scripts"}}
    <script>
        runPageScripts();
    </script>
{{/contentFor}}
```

## `{{{body}}}` helper

The `{{{body}}}` helper behaves in a similar fashion to a defined block helper, but doesn’t require a corresponding `contentFor` helper in the inheriting template file.

### `{{{body}}}` example

```handlebars theme={"dark"}
<!-- default.hbs -->

<div class="site-wrapper">
    {{{body}}}
    <!-- ... -->
</div>
```

***

```handlebars theme={"dark"}
<!-- post.hbs -->

{{!< default}}

<section class="post-full-content">
    <div class="post-content">
        {{content}}
    </div>
</section>
```

Inherited template files, files that contain `{{{block "block-name"}}}`, cannot be templates used directly by Ghost. `post.hbs`, `page.hbs` `index.hbs` can inherit other template files and used the `contentFor` helper but cannot contain block definitions. See our [theme structure documentation](/themes/structure/#templates) for more information.
