Search code examples
aemsightly

How to display Parent Page Title in AEM Sightly?


I want to display parent page title of the page just above my current page.How do i do that in sighlty?


Solution

  • You can see the list of global objects available to Sightly in an AEM Application.

    As mentioned by rakhi4110, one of the objects is currentPage, which is an instance of the Page class. Page has the getParent() method available. However since this might return null you should probably wrap your usage in a test:

    <h1 data-sly-test="${currentPage.parent}">
        ${currentPage.parent.title}
    </h1>