I want to render an existing node (content element) of one page in another page - is that possible by fusion? It’s like setting a content reference by inspector/backend user interface, but doing that by code. Background is that I’m generating an amount of pages, and they shoud have one content element that is editable a one central place, because it’s for all the same. I can add a reference by hand to all 400 pages, but I would love to do this by code
If you automate the creation of the pages you could at the same time also auto generate the references? Otherwise if you auto generate the one content element then you could basically hardcode the ID and find it in fusion by ID q(site).find('#the-node-id-here').get(0). So there is definitely options.
Also hello here! Didn’t know you (still) do Neos.
yes, hello here Christian, of course I (still) do Neos And thanks for your immediate answer.
Finding the node to show is not the problem, for test I use a simple html-block with an image inside:
But I’m not able to render it Nothing will be shown, or, only the path like ‘Node /xx7/lajsdfl/sjdfla…’ as a string. First I tried to reproduce the usage of Neos’ ContentReferences, like this:
but also nothing is shown. So, what is the recommended way to include/render an existing content element, or node, of one page in every other page of a specific type by default? Thank you
logically, I want to set a reference as I would do by adding a node of type ‘Insert content references’ to the content collection of a page an then choosing a target node by inspector
The core of what you need to do is the same as the reference content does here
It takes a Neos.Fusion:Collection and passes the nodes to render as an array, and uses Neos.Neos:ContentCase as itemRenderer. Should be quite the same for you
So, I finally solved it by using the nodePath of the existing content collection with the elements in that I want to share/include - as detailed described in this post: Rendering another Node inside a Node. Thank you for support guys