Legacy Knowledge Base
Published Jun. 30, 2025

Canonical urls for commerce products

Written By

Kanchan Bisht

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

Issue

  • Canonical URLs work correctly for pages in different locales, however, users want the same for their products so that the correct canonical tag is displayed for their product based on the page locale.

Environment

  • Liferay DXP [all updates]
  • Quarterly Release

Resolution

  • Follow the below steps:
    1. Navigate to Control Panel > Instance Settings > Pages
    2. In the 'VIRTUAL INSTANCE SCOPE' section open the SEO section
    3. In the 'Canonical URL' option there are two options:
    • Use Default Language URL
    • Use Localized URL

    Selecting "Use Default Language URL" will make all pages use as canonical URL the URL set for the default language of the site. Selecting "Use Localized URL" will set for each localized page the URL corresponding to its language as canonical URL. 

    For this use case, users need to select 'Use Localized URL', this way all the canonical URLs will point to their required locale.
    Please note: these settings are available at instance as well as system level. Choose as per the use case. 

Additional Information

  • The URL is defined in the asset (product) and the site builds the rest of the URLs for the languages configured in the instance. For example for Web content that should be similar to a product, the slug defined in web content is /w/wc1 , therefore the canonical URL can be http://localhost/web/guest/w/wc1, and the rest of the locale will be like this:
    <link href="http://192.168.40.58:7400/web/guest/w/wc1" rel="canonical" />
    <link href="http://192.168.40.58:7400/zh/web/guest/w/wc1" hreflang="zh-CN" rel="alternate" />
    <link href="http://192.168.40.58:7400/es/web/guest/w/wc1" hreflang="es-ES" rel="alternate" />
    <link href="http://192.168.40.58:7400/sv/web/guest/w/wc1" hreflang="sv-SE" rel="alternate" />
    <link href="http://192.168.40.58:7400/ja/web/guest/w/wc1" hreflang="ja-JP" rel="alternate" />
    <link href="http://192.168.40.58:7400/nl/web/guest/w/wc1" hreflang="nl-NL" rel="alternate" />
    <link href="http://192.168.40.58:7400/hu/web/guest/w/wc1" hreflang="hu-HU" rel="alternate" />
    <link href="http://192.168.40.58:7400/ar/web/guest/w/wc1" hreflang="ar-SA" rel="alternate" />
    <link href="http://192.168.40.58:7400/pt/web/guest/w/wc1" hreflang="pt-BR" rel="alternate" />
    <link href="http://192.168.40.58:7400/de/web/guest/w/wc1" hreflang="de-DE" rel="alternate" />
    <link href="http://192.168.40.58:7400/ca/web/guest/w/wc1" hreflang="ca-ES" rel="alternate" />
    <link href="http://192.168.40.58:7400/fi/web/guest/w/wc1" hreflang="fi-FI" rel="alternate" />
    <link href="http://192.168.40.58:7400/fr/web/guest/w/wc1" hreflang="fr-FR" rel="alternate" />
    <link href="http://192.168.40.58:7400/web/guest/w/wc1" hreflang="en-US" rel="alternate" />
    <link href="http://192.168.40.58:7400/web/guest/w/wc1" hreflang="x-default" rel="alternate" />
  • For content and widget pages, it is allowed to define a specific canonical URL in the SEO settings, and in the case of the Display page, it is configured in the Product with the FriendlyURL setting.
  • When a DPT is used for displaying the product, the canonical is automatically the FriendlyURL of the default locale of the site or instance. 
Did this article resolve your issue ?

Legacy Knowledge Base