'current' Class missing for menu

Hey,
Have created a menu in my footer content collection via neos backend. The “current” class in my footer menu didn’t appear when visiting (for example) the Impressum page. I have only added ´renderHiddenInIndex = 1´ to my custom ´TYPO3.Neos.NodeTypes:Menu´ prototype.

My custom Menu.ts2

prototype(TYPO3.Neos.NodeTypes:Menu){
    renderHiddenInIndex = 1
}

Rendered html:

<nav class=" typo3-neos-nodetypes-menu">
    <ul>
        <li class="normal">
            <a href="/impressum.html">Impressum</a> <!-- this is the current page but the wrong class appear on parent li -->
        </li>
        <li class="normal">
		<a href="/datenschutz.html">Datenschutz</a>
        </li>
        <li class="normal">
		<a href="/kontakt.html">Kontakt</a>
        </li>
    </ul>
</nav>

Facts:

  • My main navigations works without problems
  • when adding current.attributes.class = ‘current’ to my Manu.ts2 file the “current” class appears but not on the correct li after visiting another link

Did i forget something?

thanks,
rene

Hi, did you use the item.state in fluid?

< f:for each="{items}" as=“item”>
< li{ts:render(path:’{item.state}.attributes’, context: {item: item}) -> f:format.raw()}>

Christian.

Nope, used this one: https://github.com/neos/Neos.Demo/blob/master/Resources/Private/Templates/TypoScriptObjects/MainMenu.html

The problem is that only the first element does not get the current class if you click on in. Every other page in metamenu get the current class.

Change the typoscript part in Root.ts2:

from:

startingPoint = ${q(site).children(‘metamenu’).get(0)}

to:

startingPoint = ${q(site).children(’[uriPathSegment=“metamenu”]’).get(0)}

should solve the problem

1 Like