Content (footer) across all pages


like in the docs I want to get a footer/content across all pages. I want the site root to be a shortcut to the first subpage, so I cannot use the created homepage node type in the site root. I want to store the footer in the first subpage (named “home”). TypoScript code looks like that:

footer = TYPO3.Neos:ContentCollection {
        nodePath = ${q(site).find('footer').property('_path')}
        collection = ${q(site).find('home').children('footer').children()}

After ./flow flow:cache:flush --force and ./flow node:repair --node-type TYPO3.Neos.NodeTypes:Page I get an exception in font- and backend at the place where I putted in the {footer -> f:format.raw()} in the html:

No content collection of type TYPO3.Neos:ContentCollection could be found in the current node and no node path was provided. You might want to configure the nodePath property with a relative path to the content collection.
landingPage<TYPO3.Neos:Page>/ body<TYPO3.TypoScript:Template>/ footer/ __meta/ context/ node<>/

At the context structure I can see the “Content Collection (footer)” only at this subpage (home). What I’m doing wrong? The docs say that I don’t have to store the footer in the site root.

Your nodePath and Collection got different queries. Could you try for nodePath nodePath = ${q(site).find('home').children('footer').property('_path')}

This doesn’t work for me, either.

I’ve exactly this snippet (almost equal to your snippet with @stolle’s comment applied) to render the footer which is maintained on a node named ‘en’ and it works fine. Can you match this with your current snippet?

footer = TYPO3.Neos:ContentCollection {
    nodePath = ${q(site).children('en').children('footer').property('_path')}
    collection = ${q(site).children('en').children('footer').children()}

Are you 100% sure this error is from the footer rendering? Maybe you can test with for example this snippet to see if the error is gone?

footer = 'footer here'

What about find() vs children() @radmiraal?
@itoop ‘footer’ is the name of your contenCollection, right? You migh’t try to access the node via children() or use the the identifier. The snippet would look like this:

footer = TYPO3.Neos:ContentCollection {
        nodePath = ${q(site).find('#youridentifier').children('footer').property('_path')}
        collection = q(site).find('#youridentifier').children('footer').children()}

You also might be able to fetch the first children below the site node with
${q(site).children('[instanceof TYPO3.Neos:Document]').first().children('footer')

There should not be a difference, .children(‘node-name’) equals .find(‘relative-path’) imho

Yeah, but find('footer') looks like the collection path, and the document with the site is missing. Can find skip some parts of the relative path? I think the correct path would be something like q(site).find('page1/footer')

@stolle aah :wink: Yes, it should be. I never used it though… The FindOperation itself documents it:

 * Example (relative path):
 * 	q(node).find('main/text1')

I tried that - same exception.

I think so - because with footer = 'footer here' footer here appears in frontend (by the way I’m using {parts.footer -> f:format.raw()} to get it). And if I try it with the site root, it works.

Doen’t work, too :frowning:

Not exactly…this one works for me:

 footer = TYPO3.Neos:ContentCollection {
            nodePath = ${q(site).find('#identifier').children('footer').property('_path')}
            collection = ${q(site).find('#identifier').children('footer').children()}

This one works, too:

footer = TYPO3.Neos:ContentCollection {
                nodePath = ${q(site).find('node-570346bdd7673').children('footer').property('_path')}
                collection = ${q(site).children('footer').children()} 

@itoop What is the nodepath of your ‘footer’ content collection in the database?

@radmiraal /sites/sitename/node-570346bdd7673/footer

Did you declared the footer in your site-package NodeTypes.yaml ?

Configuration/NodeTypes.yaml of site-package:

      type: 'TYPO3.Neos:ContentCollection'

@dbuecker : Yes, I did:

    'TYPO3.Neos.NodeTypes:Page': TRUE
    label: 'Homepage'
      type: 'TYPO3.Neos:ContentCollection'