[Neos] How to generate section index menu?

Aske Ertmann aske at moc.net
Sat Mar 22 18:11:53 CET 2014

Hey Charles

You can do it with a simple template object. Here's an example:

contentMenu = TYPO3.TypoScript:Template {
	templatePath = 'resource://Moc.Net/Private/Templates/TypoScriptObjects/ContentMenu.html'
	items = ${q(node).children('[instanceof TYPO3.Neos:ContentCollection]').children('[instanceof Moc.Net:SectionGrid][showInContentMenu = true]')}

{namespace moc=Moc\Net\ViewHelpers}
<f:if condition="{items}">
		<f:for each="{items}" as="item">
				<a href="#{item.properties.header -> moc:slugify()}" class="content-menu-item">{item.properties.header -> f:format.stripTags()}</a>

We've used a slugify view helper to turn the title into an id which we also use for the content elements we're creating a menu for. You can also just use the identifier by using {item -> f:format.identifier()} and then make sure that is also done to your content elements. That can be done using the attributes for the content wrapping. Example:

prototype(TYPO3.Neos:Content) {
	attributes.id = ${node.identifier}

Hope this helps.


On Mar 19, 2014, at 2:59 PM, Charles Brunet <charles at cbrunet.net> wrote:

> How can I build a section index menu for a page?
> My guess is that I should generate anchors for headline nodes, and that I should search for all the headline nodes of the current page. But can I do that using the Menu prototype, or do I have to design my own plugin to do that?
> _______________________________________________
> Neos mailing list
> Neos at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/neos

More information about the Neos mailing list