Alternative Language links are not forming properly | Community
Skip to main content
Level 2
March 5, 2024

Alternative Language links are not forming properly

  • March 5, 2024
  • 2 replies
  • 1720 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

pulkitvashisth
Community Advisor
Community Advisor
March 5, 2024

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?

NavinTAuthor
Level 2
March 7, 2024

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

Raja_Reddy
Community Advisor
Community Advisor
March 5, 2024

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.

NavinTAuthor
Level 2
March 7, 2024

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.