Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Is it possible for the author to add/remove child pages from the navigation/root component?

Avatar

Level 2

Hi all!

We are creating a POC for the footer component and we have created a custom component in which it takes in the root path of the user and it displays the children and grandchildren pages (2 levels). We have done this so the author won't need to author all the child pages individually. 

One of the requirements is to give the author an option to remove pages (grandchildren) for the footer component without removing the page from the project structure which we have managed to do.

 

Another requirement is for the author to add pages which aren't present in that root (without actually creating a page in the project structure) by just having to add/author the page title and link. Is this requirement possible to achieve? What would be an appropriate way to structure the dialog to decide which column the author wants to add the grandchild to?

Thank you and apologies if the description is confusing.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @karthik2906,

To remove pages (grandchildren) from the footer component, you can use "Hide in Navigation" option within the page properties.

To include pages (not available in the page structure) within the Navigation component, you'll need to implement the Sling Delegation Pattern.

Incorporate a Multifield into the proxy navigation component, and develop a custom Sling Model that extends the Core Navigation implementation which will merge Core Component Navigation Items with your customized items.

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi @karthik2906,

To remove pages (grandchildren) from the footer component, you can use "Hide in Navigation" option within the page properties.

To include pages (not available in the page structure) within the Navigation component, you'll need to implement the Sling Delegation Pattern.

Incorporate a Multifield into the proxy navigation component, and develop a custom Sling Model that extends the Core Navigation implementation which will merge Core Component Navigation Items with your customized items.

Avatar

Community Advisor

Hi @karthik2906 

You can add a new tab for custom/external links on you dialog where a multifield can be configured with path field(this helps the author to pick the parent under which the external link has to be placed), text field for link and title . This multifield can be either read in java sling models or in sightly where you iterate over the other pages(levels) to display and where ever you get a match on the multifield path field you can place the title and link.

 

Hope this helps !

 

Avatar

Level 4

@karthik2906 

If I understand correctly, we need options to add pages manually instead of fetching them dynamically. For this we can create our CQ dialog in this way =>

Create a checkbox to decide whether page will be manually authored or not.

If this is checked show (CQ dialog show hide) a dialog box below to author custom pages.

In your sling model check for this checkbox and if it is true, fetch the custom authored page and return them instead of the dynamic child and grandchild pages. If author decides not to show a particular page, he/she can leave it blank, and you can write sightly to not render the div in that case (this will fulfil your 1st requirement even when using custom authored pages).