Designs / sub nav - root node required


(Innes Zenati) #1

Matrix Version:6

Hey,

Can someone explain how I can create a sub nav design which is useable throughout my site and not inherit only the set root node and its children?

I can create multiple sub nav designs with the relevant root node set as the parent page where I want the sub nav to appear. But if I then add this sub nav design to another parent page it only inherits and prints the children of the root node.

Ideally I would like a design for a sub nav to be easily accessible to all content editors.

Sorry if I haven’t explained this clearly.


(Kieran) #2

If I’m understanding correctly, you want to list the children of the currently viewed page.

You can use a menu design area: https://matrix.squiz.net/manuals/designs/chapters/menu-normal-design-area#:~:text=-2%20or%20children,any%20child%20pages.

Or you may want to use an asset listing with a dynamic root node: https://matrix.squiz.net/manuals/designs/chapters/menu-normal-design-area#:~:text=1%20or%20sub,remain%20the%20same.


(Innes Zenati) #3

Hey Kieran, thanks for coming back to me with those suggestions.

I would like it to be built and selectable from the metadata like these schemas:

%begin_asset_metadata_layout.template_key^eq:parent%
%asset_contents_paint_63707%
%else_begin_asset_metadata_layout.template_key^eq:latest%
%asset_contents_paint_66695%
%else_begin_asset_metadata_layout.template_key^eq:inner-no-nav%
%asset_contents_paint_81564%
%else_asset%
%asset_contents_paint_63716%
%end_asset%

This allows the editor to chose which layout… ideally it would be inner page with LH nav, but all I have been able to do so far is create multiple LH nav designs with the root node being the parent page. I was hoping I didnt need to keep creating multiple designs for differents sections.

I would like it to have the LH menu like this page - https://www.ros.gov.uk/performance

Hope this makes sense.
Innes


(Kieran) #4

I think I understand Innes.
You could use the same asset listing, with dynamic root node of say, “parent” variable, and pass through the root node variable as an Edge Side Include tag, in the begin/if statement.

Something like:

%begin_asset_metadata_layout.template_key^eq:parent%
<esi:include src="./?a=63707?SQ_ASSET_CONTENTS&parent=%frontend_asset_assetid% " />
%else_begin_asset_metadata_layout.template_key^eq:latest%
<esi:include src="./?a=63707?SQ_ASSET_CONTENTS&parent=%frontend_asset_assetid% " />
%else_begin_asset_metadata_layout.template_key^eq:inner-no-nav%
<esi:include src="./?a=63707?SQ_ASSET_CONTENTS&parent=%frontend_asset_assetid% " />
%else_asset%
<esi:include src="./?a=63707?SQ_ASSET_CONTENTS&parent=%frontend_asset_assetid% " />
%end_asset%

And if you wanted the menus to look differently, you would probably need to use different listings (as in your example) and change the “a=_____” to the correct listing.

Here’s some links to check out:
https://docs.squiz.net/matrix/version/latest/tutorials/designs-and-templates/use-esi-with-squiz-edge.html
https://matrix.squiz.net/manuals/concepts/chapters/url-suffixes-and-query-strings#query-strings