Hi @ SiuhnexusAtHS!
I am quite new to NEOS, but as far as I understand(!) I have a very similar use case, which I just solved with advise and a lot of friendly and patient help of the community (BIG thenks again to all of you!).
I am writing a new tutorial about the topic (the shared-footer-tutorial did not work for me, I am not sure why) but it might still take some days, so for now in short:
- We created a NodeType for specific Content and
- A NodeType ContentCollection restricted to only this NodeType.
- We created a NodeType for a Page to hold this kind of Content Collection in its ‘main’ childNode.
Like this the Editor has a place to only add the specific Type of Content.
- We created a Fusion Object to get the Content of the specific Page using Flow Queries
- We included this Fusion Object in my main Page Template - so the Content shows on every page.
Could well be, it can be still optimized, but this should be a working example for NEOS 8.3, maybe you can adjust it for you:
1. NodeType for Content (.yaml file)
'Vendor.Site:Content.Teaser':
superTypes:
'Neos.Neos:Content': true
'Neos.NodeTypes.BaseMixins:ImageMixin': true
[...]
ui:
label: 'Teaser'
icon: picture
properties:
[...]
2. NodeType for ContentCollection (.yaml file)
'Vendor.Site:Collection.Content.Teaser':
superTypes:
'Neos.Neos:ContentCollection': true
'Neos.Neos:Content': true
ui:
label: 'Teaser List'
constraints:
nodeTypes:
'*': false
'Vendor.Site:Content.Teaser': true
3. NodeType for Page (.yaml file)
'Vendor.Site:Document.TeaserContainer':
superTypes:
'Neos.Neos:Document': true
ui:
icon: fas fa-folder
label: 'Teaser Container'
childNodes:
main:
type: 'Vendor.Site:Collection.Content.Teaser'
4. Object for fetching the content (.fusion file)
prototype(Vendor.Site:TeaserList) < prototype(Neos.Neos:ContentCollection) {
@context.node = ${q(site).find('[instanceof Vendor.Site:Document.TeaserContainer]').children('main').get(0)}
content {
items = ${q(site).find('[instanceof Vendor.Site:Document.TeaserContainer]').children('main')}
}
}
‘@context.node’ fetches the correct site using the Page Type.
‘content.items’ fetches the Content Collection ‘main’ on that page.
Just to show the potential: we spiced up the Flow Query to show only three randomly chosen elements on every page call…
items = ${Array.Slice(Array.Shuffle(q(site).find('[instanceof Vendor.Site:Document.TeaserContainer]').children('main').children()), 0, 3)}
…which then also leads to switch this kind of Collection to “uncached”:
@cache {
mode = 'uncached'
context {
1 = "site"
2 = "node"
3 = "documentNode"
}
}
5. Adding to the Template (.fusion file/files)
body = Vendor.Site:Component.Template.Default {
[...]
teaserlist = Vendor.Site:TeaserList
[...]
}
and of course
{props.teaserlist}
at the appropriate places, depending on your way of doing it.
hope the helps…
have a great day!
oe