---
title: Webgen::ContentProcessor::Blocks
---
## Description
This processor replaces a special xml tag with rendered blocks. It is used, for example, in
templates to define the place where the actual page content should be.
The general syntax is as follows:
So it is basically an XML tag with two attributes, `name` and `chain`. The `name` attribute
specifies the name of the block that should be rendered in place of the block tag. The next node in
the used node chain needs to have a block that is named so, otherwise an error is thrown (if there
is only one node left in the node chain that node is used). The block is rendered according to its
render pipeline and then inserted.
The optional attribute `chain` specifies the node chain that should be used for rendering the
block. Its value needs to be a list of (localized) canonical names of nodes separated by semicolons
that should be used as node chain. If this attribute is not specified the default node chain is
used.
This is more easily explained with examples. Assume we have a `default.template` file, a
`page.template` file and a `my.page` file with the following contents:
The `default.template` file:
--- name:content pipeline:blocks
before default
after default 1
after default 2
The `page.template` file:
--- name:content pipeline:blocks
before page 1
after page 1
And the `my.page` file:
--- name:content pipeline:
The content of the page file.
When `my.page` gets rendered to `my.html`, the node chain looks like this by default:
default.template ---> my.page
The first webgen block tag just inserts the rendered block named `content` of `my.page`. The second
block tag uses a custom node chain. Therefore the block named `content` of `page.template` gets
rendered using the node chain:
page.template ---> my.page
and then inserted. Summing up the above, the rendered file `my.html` will then look like this:
before default 1
The content of the page file.
after default 1
before page 1
The content of the page file.
after page 1
after default 2