Hi,
I’m currently trying to extend my frontend with a json view. I moved along with the example given in the documentation ( http://neos.readthedocs.org/en/latest/ExtendingNeos/RenderingSpecialFormats.html ).
The goal is to get the content of a single page by just replacing the default .html uri suffix with .json (download.html --> default html view, download.json --> json view).
So I added the following route in my Configuration/Routes.yaml:
-
name: 'JSON view'
uriPattern: '{node}.json'
defaults:
'@package': TYPO3.Neos
'@controller': Frontend\Node
'@action': show
'@format': json
routeParts:
node:
handler: TYPO3\Neos\Routing\FrontendNodeRoutePartHandlerInterface
appendExceedingArguments: true
Furthermore I defined the type “json” as a typoscript root object.
json = TYPO3.TypoScript:Http.Message {
httpResponseHead {
headers.Content-Type = 'application/json'
}
content = TYPO3.TypoScript.value {
value = 'Testing value just to check the output'
}
}
I took the NeosDemoTypo3Org Site package for my development. Accessing the pages through *.html works fine, accessing the pages through *.json only works for the download page. All other pages render the default html-view although accessing them via the .json - route.
The implementation of the typoscript root object “json” seems to be ok - as all my changes work with the download page immediately (adding more fields, changing names etc.). I already tried figuring out whether there’s something special about the download page - but it doesn’t seem so.
Now my questions:
- Why does this only work with ONE page (the download page)?
- Is this the correct way of implementing a special frontend rendering format or is there any way to achieve this more easy?
Thank you in advance
P.S. all packages are the latest versions installed via composer (“typo3/neos”: “~2.1.0” etc.)…