Skip to main content
gdWebct
Adobe Champion
Adobe Champion
Aug 18, 2022 6:55 PM UTC
Solved

Canonical URL and hreflang tag automation

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!

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

3 replies

Ravi_Pampana
Community Advisor
Community Advisor
Aug 19, 2022 6:25 AM UTC

Hi,

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

 

Ex: 

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

Translate
Ravi Pampana
gdWebct
Adobe Champion
gdWebctAdobe ChampionAuthor
Adobe Champion
Aug 19, 2022 12:16 PM UTC

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!

Translate