include: Pages/*
include: NodeTypes/*
include: Form/*
include: Prototypes/*
include: Search/*

root {
    tportalHeader {
        include: Pages/TportalHeader.fusion

        @position = 'start'
        condition = ${request.arguments.type == 'tportal_header'}
        type = 'Newland.CityTheme:TportalHeader'
    }

    tportalFooter {
        include: Pages/TportalFooter.fusion

        @position = 'start'
        condition = ${request.arguments.type == 'tportal_footer'}
        type = 'Newland.CityTheme:TportalFooter'
    }

    tportalComplete {
        include: Pages/TportalComplete.fusion

        @position = 'start'
        condition = ${request.arguments.type == 'tportal_complete'}
        type = 'Newland.CityTheme:TportalComplete'
    }

    @cache {
        entryIdentifier {
            # The "type" argument yields a completely different output.
            type = ${request.arguments.type}
        }
    }
}

error {
    # Find the document to render in case of 404
    @context.notFoundDocument = ${q(site).children('[instanceof Neos.Neos:Document]').filter('[uriPathSegment="404"]').get(0)}

    # Custom matcher for 404 status
    4xx {
        @position = 'start'
        condition = ${statusCode >= 400 && statusCode < 500 && notFoundDocument}
        renderer = Neos.Fusion:Renderer {
            @context.node = ${notFoundDocument}
            @context.documentNode = ${notFoundDocument}
            renderPath = '/root'
        }
    }
}
