I hv a requirement using the same editable template I have to create 10 pages out of which 5 pages' header footer complete layout is different from the other 5 pages. How to achieve this with one editable template
Please help me with this urgent requirement.
Thank You.
Solved! Go to Solution.
Hi @divanshjohndigital There are multiple ways to achieve the use case mentioned by you based on the business requirement.
Requirement I : (based on the locale the header/footer has to a different layout)
fetch the url of the current page and get the locale
@ScriptVariable
private Page currentPage;
String pagePath = currentPage.getPath();
final String[] = pagePath.split(SLASH);
final String locale = pagePath.startsWith(PATH_CONTENT) ? String.format("%s%s%s", split[4], HYPHEN, split[5]) : StringUtils.EMPTY;
Now based on the locale you can auotmatically decide which layout needs to be displayed.
Requirement II (displayed the layout based on the selection within the footer/header):
Reference you using the initial content is as follows:
Hope this helps!
Thanks
@divanshjohndigital In case there is a limited number of pages, I suggest you unlock the experience fragment component on an editable template and let the AEM content author select the experience fragment path in every newly created page. Otherwise, create separate editable templates by considering the first template path structure as sling resourceType.
Hi @divanshjohndigital There are multiple ways to achieve the use case mentioned by you based on the business requirement.
Requirement I : (based on the locale the header/footer has to a different layout)
fetch the url of the current page and get the locale
@ScriptVariable
private Page currentPage;
String pagePath = currentPage.getPath();
final String[] = pagePath.split(SLASH);
final String locale = pagePath.startsWith(PATH_CONTENT) ? String.format("%s%s%s", split[4], HYPHEN, split[5]) : StringUtils.EMPTY;
Now based on the locale you can auotmatically decide which layout needs to be displayed.
Requirement II (displayed the layout based on the selection within the footer/header):
Reference you using the initial content is as follows:
Hope this helps!
Thanks