Ishita Gandhi
Ishita Gandhi

Reputation: 21

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?

Upvotes: 0

Views: 11242

Answers (2)

Jordan Shurmer
Jordan Shurmer

Reputation: 1076

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>

Upvotes: 1

rakhi4110
rakhi4110

Reputation: 9281

You can use ${currentPage.parent.title} or ${currentPage.getParent.getTitle} to get the title of the parent page.

Upvotes: 1

Related Questions