Condition in root page template

Good morning,

our marketing would like to provide an RSS feed for our website. I know how to archive this with a new route entry and an own fusion configuration. But I would like to do it in a different way.

I’ve created the possibility to select a template on each page (screenshot). And wenn the template «RSS» is selected, the RSS output should be generated. But in this case I need a second fusion page configuration with a condition. When the value of the attribute «template» is not «rss.xml» render the standard page, and when it is «rss.xml» render the XML output.

I know that this is wrong, but I thought of something like this:

root = Neos.Fusion:Case {
    if {
        condition = ${q(node).property('template') == 'resource://Laudert.Website/Private/Templates/Page/rss.xml'}
        type = 'Neos.Fusion:Http.Message'
        include: Rss.fusion
    }
    else {
        condition = ${q(node).property('template') != 'resource://Laudert.Website/Private/Templates/Page/rss.xml'}
        type = 'Neos.NodeTypes:Page'
        include: Page.fusion
    }

    include: NodeTypes/*
}

I guess something like this should work:

root {
    RSSRenderer {
        condition = ${q(node).property('template') == 'rss'}
        type = 'Laudert.Website:RSSRenderer'
        @position = 'before format'
    }
}

prototype(Laudert.Website:RSSRenderer) < prototype(Neos.Fusion:Http.Message) {
    ...
}

Hi Sebastian,

thank you, this works great! :slight_smile:
The only thing left is that the RSS page is only visitable via «rss.html» and not «rss.xml». If I add a new sub route (Routes.yaml of my site package) it works, but every other page can also be visited with «*.xml» and a Neos error appears.

-
  name: 'RSS feed'
  uriPattern: '{node}.xml'
  defaults:
    '@package': Neos.Neos
    '@controller': Frontend\Node
    '@action': show
    '@format': rss
  routeParts:
    node:
      handler: Neos\Neos\Routing\FrontendNodeRoutePartHandlerInterface
  appendExceedingArguments: true