Example Content Dimensions

Content dimensions are a powerful tool of Neos. It allows you not only simple language variations of your site, but also subdivisions that you can choose yourself. For example, you can create different content for countries, places, cars or whatever you can think of. They are easy to set up, but need a few comand lines to be fully registered in Neos.

In the upper right corner of the website you will see a new menu item "Deutsch". I created a content dimension for languages just for this example. Furthermore, the Content Dimension menu is registered inside the Neos.Neos:Menu. If you need it in a different place, you should consider another place to register the Content Dimensions Menu in the fusion file.

After changing the content dimensions, you should run this command. Backup your page content before running this!!!
​​​​​​​

$ ./flow node:migrate 20150716212459


Look what's behind it:

Neos:
  ContentRepository:
    contentDimensions:
      language:
        label: Languages
        icon: icon-language
        default: en_US
        defaultPreset: en_US
        presets:
          all: null
          de:
            label: 'Deutsch'
            values:
              - de
            uriSegment: de
          en_US:
            label: 'English'
            values:
              - en_US
            uriSegment: en

prototype(Arsors.Neos:DimensionsMenu) < prototype(Neos.Fusion:Component) {

dimensionsItems = Neos.Neos:DimensionsMenuItems {
dimension = 'language'
}

renderer = afx`
<ul class="languageMenu navbar-nav">
<li class="nav-item d-none d-lg-block"><div class="nav-text">Neos 4.3 examples</div></li>
<Neos.Fusion:Loop items={props.dimensionsItems} item="item">
<li @if.notCurrent={item.state != 'current'} @if.nodeExists={item.node} class="nav-item">
<Neos.Neos:NodeLink attributes.class={[item.state, "nav-link"]} node={item.node} content={item.label} />
</li>
</Neos.Fusion:Loop>
</ul>
`

}

Here we include the DimensionsMenu to our HeaderMenu.

prototype(Arsors.Neos:HeaderMenu) < prototype(Neos.Neos:ContentComponent) {

  [...]

  renderer = afx`
      [...]
        <span class="navbar-text">
          <Arsors.Neos:DimensionsMenu />
        </span>
      [...]
  `
}
Last cache from 2021-05-14 at 01:41:50 (Example Eel Helper)