Skip to main content
March 22, 2023
Solved

how to embed navigation core component inside HTL/sightly

Hi I have requirement where I wanted to use aem navigation(available across all templates) core component inside my project but dont want to expose in model.json.

Currently If I placed this template root level under jcr:content, this component still acts like a normal component and exposed in model.json.

But I dont want to expose I have one HTL in our project which is commonly used across all templates. I wanted to place directly inside this HTL like embed/hardcoded component.

May I know how can I do this ? I have tried below syntax didn't work. looks like some required properties are missing for nav to display.

 

<sly data-sly-resource="${resource @ resourceType='core/wcm/components/navigation/v1/navigation'}"></sly>

could someone guide me how we achieve this ? 

@arunpatidar 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
Community Advisor
March 23, 2023

Hi,

You can proxy the navigation component. and use sling delegation to extend the interface and remove the @Exporter

https://github.com/adobe/aem-core-wcm-components/blob/e1d4bc90eee4c87a0ffcd16ffe15b24f58396d87/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v1/NavigationImpl.java#L59 

Arun Patidar

1 reply

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
March 23, 2023
Arun Patidar