Expand my Community achievements bar.

SOLVED

AEM 6.5.10 - Core Components alternate language inside the head meta not working

Avatar

Level 2

Currently using AEM Core components v2.18.0

I am trying to leverage the OOTB functionality for generating the Alternate Languages for page meta tags. I see the OOTB code under /apps/core/wcm/components/page/v2/page/head.links.html

Below is the piece of code which is responsible for generating it.

<link data-sly-test="${page.alternateLanguageLinks}"
data-sly-repeat="${page.alternateLanguageLinks.entrySet}"
rel="alternate" hreflang="${item.key.toLanguageTag}" href="${item.value}">

Below is my page structure

/content/<my-site>/en/<child-pages>

/content/<my-site>/ja/<child-pages>

/content/<my-site>/zh/<child-pages>

.

.

etc

 

But the above piece of code always generates empty.

 

Also i found the implementation of the code in Github

https://github.com/adobe/aem-core-wcm-components/blob/a7e377c6810dd2125a902d3ef3df5c92ec2a1719/bundl...

 

 

Can someone please explain what is com.adobe.aem.wcm.seo.SeoTags; and how to get the above code working. Am i missing some configration?

1 Accepted Solution

Avatar

Correct answer by
Administrator
19 Replies

Avatar

Correct answer by
Administrator

@puniths34934369 I would recommend creating an Issue in https://github.com/adobe/aem-core-wcm-components/issues.

 

 



Kautuk Sahni

Avatar

Level 2

Hello, I have the same problem. Did you figure it out?

Avatar

Level 2

we were forced to write our own logic without using core components

Avatar

Level 2

Can you help me to implement hreflang. this is the exact functionality i'm looking for. OOTB code given in adobe github is not returning any value.

Should i use sitemap or the code itself is enough.

is com.adobe.aem.wcm.seo package needed to implement it?

 

Avatar

Level 2

ArthurLiup_0-1693389061551.png

we were using toLanguageTag() from java.util.Locale. Does it work for you?

Avatar

Level 2

Should i use the com.adobe.aem.wcm.seo package for java implementation or java.util.Locale itself is enough

Avatar

Level 2

Can you please tell what has to be coded in alternateLanguageLinks method. I have imported the locale utility.

Avatar

Level 2

Thank you so much for your response Arthur. can u tell what has to be coded in PageTreeSitemapGeneratorImpl.

Anywhere else the changes needs to be done other than these 2 codes to make it work?

Avatar

Level 2

this method is written in PageTreeSitemapGeneratorImpl. From what I can add, the name of the property is:

ArthurLiup_0-1693744089875.png

But that's just the name of the property, which can be chosen to be anything while creating page property.

 

That's it, I think.

Avatar

Level 2

 rel="alternate" hreflang="${item.key.toLanguageTag}" href="${item.value}">
in this line what value will "item" hold?

Avatar

Level 2

It is the element from map that is the result of the method I sent above.

Avatar

Level 2

Hi Arthur,

 

With what value the variable "page" has to be initialized

Avatar

Level 2

Thanks Arthur for the help. one more help. what has to be written inside the alternateLanguageLinksModel template?

Avatar

Level 2

Hi Arthur

I have implemented this hreflang code but the issue is, it is only returning links which are written in English and neglecting the links written in other languages. Example spanish, chinese, japanese etc.Is there any solution for this. Kindly help! Thanks.