Rendering special formats

Support the documentation

This documentation was written by volunteers. Please help support our effort:

Help us improve the documentation

Some parts might be outdated.

Please be careful, some parts might be outdated and do not apply anymore.

Rendering an RSS feed as XML or a document in a different format than HTML is possible by configuring a new route and adding a Fusion path that renders the format.

Let’s have a look at an example that introduce a vcard format to render an imaginary Person document node type.


First register a new route to nodes with the vcard format. URIs with that format will get an .vcf extension.

  name: 'Neos :: Frontend :: Document node with vCard format'
  uriPattern: '{node}.vcf'
    '@package': Neos.Neos
    '@controller': Frontend\Node
    '@action': show
    '@format': vcard
      handler: Neos\Neos\Routing\FrontendNodeRoutePartHandlerInterface
  appendExceedingArguments: true

Registering the route (for Neos 2.x and 3.x)

In older versions of Neos you also need to register the route in the Global Configuration/Routes.yaml (before the Neos subroutes):

# Site package subroutes

  name: 'MyPackage'
  uriPattern: '<MyPackageSubroutes>'
          package: 'My.Package'

# Neos subroutes
# ...

This will add the new route from the site package before the Neos subroutes.



The root case in the default Fusion will render every format that is different from html by rendering a path with the format value.


# Define a path for rendering the vcard format
vcard = Neos.Fusion:Case {
        person {
                condition = ${q(node).is('[instanceof My.Package:Person]')}
                type = 'My.Package:Person.Vcard'

# Define a prototype to render a Person document as a vcard
prototype(My.Package:Person.Vcard) < prototype(Neos.Fusion:Http.Message) {
        # Set the Content-Type header
        httpResponseHead {
                headers.Content-Type = 'text/x-vcard;charset=utf-8'
        content = My.Package:Person {
                templatePath = 'resource://My.Package/Private/Templates/NodeTypes/Person.Vcard.html'
                # Set additional variables for the template