aem seo canonical tagging support header image

AEM SEO: Canonical Tagging Support

Canonical Tagging Support for AEM SEO

Why does somebody need this library?

Hi there. Once I had to add a canonical tag to the pages due to duplicated content on the site. Having such duplication can greatly affect the ranking of your site so it’s important for AEM SEO as well. At that moment I had a lack of time to write something nice and flexible, so I ended up with nasty and not tested solution. It worked, but it was not something I can feel good with. Later on, I’ve decided to write the library for adding canonical tags. The main reason for creating this library was that I felt really badly about that code I could not refactor (because I was not working in that company anymore).

Detailed documentation is in git repo – Bellow, I will just outline main points.


Let’s check out features of the library:

  • Specify canonical page for another page ( /path1/page1>/path2/page1));
  • Specify the pattern for the path, so all child pages will be searched by their relative path in the lookup path (/path[1-5]=>/corporate – for each page under /path[1-5] search canonical page under the /corporate).

How to use

What are the steps to start using this library:

  • add a dependency to the library (latest version is in Maven Central Repository) or build it yourself;
  • include library’s bundle into the package with other bundles to be installed in AEM, build and install it;
  • create and configure system user for the bundle;
  • configure rules for the mapping;
  • configure Externalizer, so publish domain in specified (it will be used in canonical links);
  • insert <link rel=”canonical” /> into the page component, head section

The library has been tested with AEM 6.1 SP1.

And again,  Canonical Tagging Support for AEM SEO repository is there.

Your thoughts are welcome