Rendering Custom Document Types

Select Template based on NodeType

It is possible to select the page rendering configuration based on the node type of the page. Let’s say you have a custom node type named Your.Site:Page which has Neos.NodeTypes:Page as a supertype. You added a Your.Site:Employee page which is used for displaying a personal page of employees working in your company. This page should have a different rendering output compared to your basic page.

NodeType inheritance example

The right approach would be to create a Fusion prototype for your default page and employee page like:

prototype(Your.Site:Page) < prototype(Neos.Neos:Page) {
    body.templatePath = 'resource://Your.Site/Private/Templates/Page/Default.html'
    # Your further page configuration here

prototype(Your.Site:EmployeePage) < prototype(Your.Site:Page) {
    body.templatePath = 'resource://Your.Site/Private/Templates/Page/Employee.html'
    # Your further employee page configuration here

Because Neos provides the documentType matcher out of the box (see Rendering A Page), these prototypes will be automatically picked up and rendered by Fusion, giving you the possibility to control the rendering for each page type individually.