[SOLVED] Accessing Page Attribute from BodyScripts

I added a new attribute to page: pageType

I can access this attribute fine from the page template using this:

{node.properties.pageType}

but not from BodyScripts.html:

<f:section name="commonBodyScripts">
    {node.properties.pageType}
</f:section>

Root.fusion:

...
body {
    sectionName = 'body'
    javascripts.site = Neos.Fusion:Template {
        sectionName = 'bodyScripts'
        commonBodyScripts = Neos.Fusion:Template {
            templatePath = 'resource://vendor.site/Private/Templates/Include/BodyScripts.html'
            sectionName = 'commonBodyScripts'
        }
    }
}

Can you please help me how could I access page attributes from those included sections?

Thank you,
Daniel

Hi @tade,
have you tried with something like this?

 commonBodyScripts = Neos.Fusion:Template {
            templatePath = 'resource://vendor.site/Private/Templates/Include/BodyScripts.html'
            sectionName = 'commonBodyScripts'
            propertyToImport = ${q(node).property('pageType')}
        }

and then in your BodyScirpts.html you call {propertyToImport}.

Did not try it but as a first attempt, reading straight from docs

Hope it helps,
Nicola

It works!!! Thank you very much and I apologize for my not finding it in the docs, you’re right it’s clearly there.

No problem at all man, that’s the way we all learn… :wink: