I'm working on AEM as cloud service, we are using OOTB functionality for alternative links in our head.link.html file.
<link data-sly-test="${page.alternateLanguageLinks}" data-sly-repeat="${page.alternateLanguageLinks.entrySet}" rel="alternate"
hreflang="${item.key.toLanguageTag}" href="${model.hostName}${item.value @ extension}">
above code is not working properly, Sometimes it return 3 locale pages only where it should return 4 and sometimes it return empty.
Note:- I have enabled the checkbox (render alternative language links) in template page policy. Also other locale pages are created using OOTB AEM language copy option only.
Can anyone suggest what could went wrong? or any other approach to render alternative language links?
Views
Replies
Total Likes
Hi @NavinT
There is an open issue at github repo for AEM Core components for this
https://github.com/adobe/aem-core-wcm-components/issues/2505
Is this the same issue you are facing?
Hi @pulkitvashisth , Thank you for your response, Yes i;m also facing the same issue.
Hi @NavinT
Verify that the page.alternateLanguageLinks
property is correctly populated with the alternative language links. You can do this by inspecting the page properties in AEM.
Make sure that the page.alternateLanguageLinks
property is being passed correctly to the head.link.html
file. Check if the variable is being set correctly in the model or request attributes.
Check if the page.alternateLanguageLinks.entrySet
is returning the expected number of entries. You can add some debug statements or log messages to verify this.
Ensure that the model.hostName
and item.value @ extension
are correctly set and pointing to the correct URLs.
Hi @Raja_Reddy, Thanks for response.
page.alternateLanguageLinks is coming null in head.link.html. but this is happening for few pages and for other pages, Alternative language links are coming correctly.