Expand my Community achievements bar.

Implement Navigation as Inherited Component

Avatar

Level 2

Hi all,

 

We are using AEM 6.4.
Looking for a suggestion on implementing the following feature.

We have multiple types of users that get redirected to a separate section of the website based on their role after login.

The navigation is different for every section. I want to somehow define the navigation at the home page of the section and then let all children inherit it. I don't want to create multiple templates just to have different navigation.
Noticed that InheritanceValueMap doesn't allow inheriting nodes/resources but just properties, so can't use that feature.

 

Is there any other way to implement this iParsys kind of feature?

 

Thanks

Ruchi

1 Reply

Avatar

Employee Advisor

Hi,

 

My recommendation is to think about 3 aspects:

* How would you manage and design any single navigation? Should it require a developer to craft it? Or do you require it to be defined by an author using some kind of UI?

* Next is the mapping of the "role" to a specific navigation? Where is this maintained? Defined by a user/super-user? Admin? AEM developer?

* And finally the easiest question: How do you want to include this navigation into the page?

 

I would start with the details of the requirements and try to answer the first question first. One thing you could use is a Content Fragment or Experience Fragment to model to model the navigation. There is already an editor, tooling etc available for it.

For the mapping of role to navigation you probably need some type of dialog (multi-value), which allows you select a group name in a drop down and which allows to specify a navigation you created before.

 

When you have done that, you need to think about how it can be easily integrated into the page rendering process. I would opt to design specific a specific MainNavigation class, which encapsulates the CF/XF and is able to map that CF/XF into a navigation. The selection of the correct navigation based on inheritance is something I would hide within a adapter pattern, so you could use something like:

 

page.adaptTo(MainNavigation.class).firstLevel().foreach(...)

 

Focus first on the design, on the content structure and all the requirements. Coding is then the easiest part.