Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

Alternative Language links are not forming properly

Avatar

Level 2

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?

4 Replies

Avatar

Level 6

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?

Avatar

Level 2

Hi @pulkitvashisth , Thank you for your response, Yes i;m also facing the same issue.

Avatar

Community Advisor

Hi @NavinT 

  1. 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.

  2. 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.

  3. 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.

  4. Ensure that the model.hostName and item.value @ extension are correctly set and pointing to the correct URLs.



Avatar

Level 2

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.