Canonical links

  • Updated

Use canonical links in Optimizely Configured Commerce to help improve the overall Search Engine Optimization (SEO) score. Search engines give lower SEO scores to websites with multiple pages of the same content but different URLs. By defining the canonical link on duplicate pages, a website can tell the search engine that data about the duplicate pages should be combined, which improves the SEO and focuses the crawlers on the preferred page content. When the search engine results show a website page, defining the canonical URL increases the likelihood of the search provider selecting your preferred URL version.

Additionally, Configured Commerce uses canonical links when searching for products. Whether a product is selected through the autocomplete or from the search results page, the resulting product page uses the canonical URL. This is expected, as the search has no real context of where the product page lives.

However, if a user goes to a product through the taxonomy (categories), the resulting product page uses the actual URL path. See the example below for more details.

Example

This example uses the flooring stapler product page on the Hero Tools website to show the various URLs:

When going to the stapler product page, the URL resolves to the full URL:

  • https://insite.insitesandbox.com/Catalog/Power-Tools/Staplers/20V-Max-Cordless-18-GA-Flooring-Stapler

Viewing the page HTML, the <head> element contains the canonical link:

  • <link rel="canonical" href="https://insite.insitesandbox.com/Product/20V-Max-Cordless-18-GA-Flooring-Stapler"></code

Because the Hero flooring stapler can also shoot nails, the product page is duplicated in the Nailer category.

When going to it from the Nailer category, the URL resolves to the full URL:

  • https://insite.insitesandbox.com/Catalog/Power-Tools/Nailers/20V-Max-Cordless-18-GA-Flooring-Stapler

Viewing the page HTML, as expected, the <head> element contains the same canonical link as the product page found under the Stapler category:

  • <link rel="canonical" href="https://insite.insitesandbox.com/Product/20V-Max-Cordless-18-GA-Flooring-Stapler">

When searching for the stapler product page, the URL resolves to the same canonical URL:

  • https://insite.insitesandbox.com/Product/20V-Max-Cordless-18-GA-Flooring-Stapler

Both product pages contain the same canonical link in the <head> element which informs search engines to only index the one canonicalized URL.

Attributes of a canonical link

  • As a best practice, the canonical link tag should contain the fully qualified URL path:
    • Correct: <link rel="canonical" href="https://insite.insitesandbox.com/Product/20V-Max-Cordless-18-GA-Flooring-Stapler">
    • Inorrect: <link rel="canonical" href="/Product/20V-Max-Cordless-18-GA-Flooring-Stapler">
  • Categories within the URL are removed from canonical links – The full URL of https://insite.insitesandbox.com/Catalog/Power-Tools/Staplers/20V-Max-Cordless-18-GA-Flooring-Stapler is canonicalized to https://insite.insitesandbox.com/Product/20V-Max-Cordless-18-GA-Flooring-Stapler
  • Search results and autocomplete show the canonicalized URL <website>/product/ProductURL
  • Canonical links use HTTP or HTTPS, depending on the HTTPS Mode setting.
  • If multiple domains are specified for a website, the first one is used.
  • When multi-language is enabled, the canonical link tag automatically includes the hreflang attribute to indicate to search engines which language is used on a specific page. For example: <link rel="canonical" href="https://insite.insitesandbox.com/"/><link rel="alternate" hrefLang="fr-fr" href="https://insite.insitesandbox.com/?setContextLanguageCode=fr-fr"/>

Canonical settings

Go to the Admin ConsoleSettings and search for the following:

  • Product Canonical Root PathThe first segment used in canonical product URLs which defaults to "Product." It may be blank if links should be at the website's root. You can override specific languages within the translation dictionary by changing the translation value for the 'Product_UrlRoot' keyword in the appropriate language.
  • Microsite Canonical ProductsIf Yes, products on microsites have their own canonical URLs. If No, they point to products on the root domain site when they exist. Default value: No
  • Canonical Link for Products In Sitemap – If Yes, canonical links are used for products in sitemap. If No, category product paths are used. Default value: Yes.