Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Canonical URL and hreflang tag automation

Avatar

Level 3

What's the most efficient way, if it exists, to dynamically add (or automate) the canonical and HREFlang tags to pages, without manually adding  <link rel=”canonical” /> onto head section of each page component? I've seen a possible solution (no JDK 11) in this library: https://github.com/otarsko/aem-seo-canonical-url

And third party tools for XML sitemaps like: https://www.stateofdigital.com/hreflang-sitemap-tool/ 

 

Any other options available? Thanks for any feedback!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
3 Replies

Avatar

Community Advisor

Hi,

Checkout https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/va... for adding hreflang tags

 

Ex: 

List<PageVariant> pageVariants = pageVariantProvider.getVariants(currentPage, slingRequest); 

Avatar

Level 3

Thank you, @Ravi_Pampana we'll  have to check this method out as well as the SAX transformer pipeline suggested by @arunpatidar. Appreciate your feedback!

Avatar

Correct answer by
Community Advisor