Add a side navigation to my content
We want to add a sidebar navigation on the left side of the Contents, in a specific ContentType :
In this example, we have a ContentType which has an identifier ‘blog’.
Firstly, we need to change the setting of the layout in our ContentType ‘blog’ to “2 columns with left bar”:
The next step is to add a dynamic layout handle for this ContentType:
So we create the following file:CONTENT_TYPE_VIEW_blog in app/design/frontend/‹Vendor›/‹Theme›/Blackbird_ContentManager/layout/CONTENT_TYPE_VIEW_blog.xml
--> For further details about the Dynamic Layout Handle, please go to the corresponding documentation page.
With the following content (if you prefer, you can also directly add it in the field layout update xml in the ContentType page edit):
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
<referenceContainer name="sidebar.additional">
<block class="Blackbird\ContentManager\Block\Content\Widget\ContentList" name="blog-sidebar-navigation-link">
<action method="setTitle">
<argument name="title" xsi:type="string">Sidebar Navigationargument>
action>
<action method="setCtType">
<argument name="type" xsi:type="string">blogargument>
action>
block>
referenceContainer>
layout>
We built our navigation with a ContentList widget block, in order to generate all the link of each content of the current ContentType.
For further details about how to customize your ContentList widget block, please go to the corresponding documentation page.