Using Page property {defined in nodetypes.yaml}

(kemal özkan) #1

I’m building my first Neos site, and I’m facing my first serious problem.
My site has a custom navigation/menu (30% width, 100% height, fixed) to achieve that, I manipulate(change) default.html in templates/ (30% of the width has been blocked statically by Templates/FusionObjects/MainMenu.html).

I want to use different menu background image on every page (ex: /about has a background image with a question mark,
/contact a background image with an envelope). So I add an “image” property to Neos.NodeTypes:Page.

How can I use the property in my MainMenu.html? I tried following options:

  1. Root.fusion
    templatePath = 'resource://hebele.hubele/Private/Templates/Page/Default.html’
    sectionName = 'body’
    parts {
    menu = Neos.Neos:Menu{
    templatePath = 'resource://hebele.hubele/Private/Templates/FusionObjects/MainMenu.html’
    propertyToImport = ${q(node).property(‘image’)}

  2. I create Fusion/NodeTypes/MainMenu.fusion
    but it didn’t work either.

Please give me a hint how to use the in a custom .html file.
Thank you in advance.

(Soren Malling) #2

You need to tell Fusion how to render the information it gets from the property. In your case you might like to do something like

backgroundImage = Neos.Neos:ImageUri {
  asset = ${q(node).property('image')}

(kemal özkan) #3

Thank you very much. It worked. I didn’t know that I can use nested “queries” in an object scope .