I have a content fragment A which is referencing content fragment B and B is referencing content fragment C.
I want to build a breadcrumb from the content fragment references. For example:
when I select a content fragment C, I should be able to see its content hierarchy in the form of breadcrumb A/B/C.
Do we any OOTB feature which can give us the content fragment reference hierarchy. If not what can be the possible ways to achieve this?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
There is no out-of-the-box (OOTB) feature in AEM that allows you to easily build a breadcrumb from the content fragment references. However, there are a few ways you could approach this problem:
You could write a custom servlet or service that retrieves the content fragment references and builds the breadcrumb string. You could then invoke this service from your content fragment component or from a client-side script to display the breadcrumb.
You could use the AEM Query Builder to retrieve the content fragment references and build the breadcrumb string. You could use it to find the content fragment references and build the breadcrumb string using the results.
You could use the AEM GraphQL API to retrieve the content fragment references and build the breadcrumb string. You could use it to retrieve the content fragment references and build the breadcrumb string using the results.
Ultimately, the approach you choose will depend on your specific requirements and the tools and resources available to you. You may want to consider factors such as the complexity of the solution, the performance and scalability needs of your application, and the skills and expertise of your team.
@ravir73578276
Not sure how would you navigate through these content fragment references to build breadcrumb. Also, there is no OOTB feature available as such, however you can create your own custom Breadcrumb component, where in on selection of a content fragment it can trace the references and can build the hierarchy until root. Also, you might have to enforce that a Content Fragment should not have more than one reference.
You can achieve this using the custom logic by taking the root CF and navigating to the references until the depth required.
This is may some performance impact as your trying to get the CF referenced and this implementation is recursive.
Hello @ravir73578276
Noticed that you have also marked your question for GraphQL API.
Are you trying to create a breadcrumb on an AEM Site or fetching this info to be accessed via GraphQL?
Right, I have the requirement to fetch this data via Graphql.
There is no out-of-the-box (OOTB) feature in AEM that allows you to easily build a breadcrumb from the content fragment references. However, there are a few ways you could approach this problem:
You could write a custom servlet or service that retrieves the content fragment references and builds the breadcrumb string. You could then invoke this service from your content fragment component or from a client-side script to display the breadcrumb.
You could use the AEM Query Builder to retrieve the content fragment references and build the breadcrumb string. You could use it to find the content fragment references and build the breadcrumb string using the results.
You could use the AEM GraphQL API to retrieve the content fragment references and build the breadcrumb string. You could use it to retrieve the content fragment references and build the breadcrumb string using the results.
Ultimately, the approach you choose will depend on your specific requirements and the tools and resources available to you. You may want to consider factors such as the complexity of the solution, the performance and scalability needs of your application, and the skills and expertise of your team.