Sign in to Community
Sign in to view all badges
We have a requirement where need to extract the list of components which are present on the page at Runtime via a Page Model. If anyone has implemented the same please share the sample.
You could follow the OOB code for "Content Tree" implementation in author or otherwise, get the page node and iterate over each node and find "sling:resourceType"
You'd have to customize based on your use case either client side or server side.
You can write JCR Queries(XPATH, SQL2 or QueryBuilder) to find out node with sling:resourceType under Page:content node of a page.