Navigation Core Component is unable to have adjusted paths for navigation

Description

We're using the wcm.io Navigation component from the wcm.io Core Components.

We noticed that the setting "navigation root" was replaced with the site root detection from Handler. This is fine, except when you configure something in the component, that is not the website root.

There seems to be no option to configure something else than the site root.

Activity

Show:
Stefan Seifert
October 28, 2019, 5:43 PM

this was done by intention under the assumption that the configured site root in the handler context is always the root you want into the navigation component.

if we want to support also arbitrary root paths we need to somehow replicate all the "magic" logic currently embedded in the adobe navigation component impl
https://github.com/adobe/aem-core-wcm-components/blob/6ab01a4f737b9a397fb8a0f56aa845bd940ac076/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v1/NavigationImpl.java#L105-L151

i wanted to avoid it. extending from that component is also not that easy as there is not method in the model's API to get only the configured (and resolved) root path.

but if you think this is an important need we might duplicate and add the logic anyways.

Henry Kuijpers
October 28, 2019, 9:51 PM

I’d say that this logic is indeed important: We use it for example to render the footer navigation (a subfolder of the site root), or the side navigation (i.e. the pages under a certain page).

So, yes, it would be very prefered to have it back, especially since the wcm.io Core Components should be a drop-in replacement for the Adobe Core Components.

Also, that funky logic (livecopy/blueprint/language copy/…) would be nice to have available generically: Maybe a good feature for one of the handler implementations? I’d like to call it from other components as well.

WDYT?

Jurgen Brouwer
October 29, 2019, 8:13 AM

I can second this. We’re using the Adobe Core Components navigation component in a sidebar on for example an account page with a custom root page to display a certain page’s child pages.
Right now we can’t replace this component with the wcm.io Core Components because of this change.

Stefan Seifert
November 5, 2019, 3:50 PM

this are good arguments - i will look into it and come up with an proposal, in a way that the logic can be reused outside the model impl classes as well.

Stefan Seifert
July 7, 2020, 12:11 PM

i've implemented a simple but useful solution that relies on built-in wcm.io url handler functionality.

in version 1.4.2-2.10.0 (based on core componetns 2.10) the navigation component respects the (optional) navigation root. it can be set to a relative paths like tools/footer/meta-nav to use this relative to the site root as navigation root, or to an absolute path (which is rewritten to the current context).

https://github.com/wcm-io/wcm-io-wcm-core-components/commit/32b4dfa6111df6bf95cc3d0e78f242e6acd20289

Fixed

Assignee

Stefan Seifert

Reporter

Henry Kuijpers

Labels

None

Components

Fix versions

Affects versions

Priority

Critical
Configure