Canonical URLs help prevent duplicate content issues by specifying the "canonical", or
"preferred", version of a web page as part of search engine optimization. Normally, search
engines lower the rankings for pages that appear to be duplicates. Indicating that a page has
a canonical URL helps preserve those rankings. This topic applies to B2C Commerce.
Required Editions
Available in: B2C Commerce SiteGenesis and SFRA
There are two ways that a search engine recognizes a canonical URL: A canonical URL tag
is included as a link element in the header of an HTML page. For example:
<link rel="canonical" href="http://www.company.com"
/>
301 redirects from URLs to a canonical URL. For example: if www.test.com, test.com,
and www.example.com/index.html have 301 redirects to example.com/home.asp, then
example.com/home.asp is a canonical URL.
A canonical URL tag is included in the header of multiple pages. For example, if
test.com, and www.example.com/index.html have canonical URL tags in their header to
example.com/home.asp, then example.com/home.asp is a canonical URL.
A canonical URL tag is often the easier way of establishing a canonical URL, especially
for Salesforce B2C Commerce pages, where similar content might have different URLs
depending on the category navigation, search feature, or landing page used to find the
content. In the SiteGenesis application, canonical URL tags are standard. However, if
your storefront is based on a previous code version, you must alter your templates to
include canonical URLS.
In the pt_productsearchresult.isml template, include the following
code in the <head> tag:
Create canonical links to a base product for it's all variation product to preserve or
improve rankings for the product. You might need to implement this differently,
depending on how your application is configured. If your application is based on
SiteGenesis, you can edit the pt_productdetails.isml template and
include the following code to implement a canonical URL link for product variations:
<iscomment>Determine if the product is a variation product and if so use the base product as the Canonical Link, will help SEO for color slicing</iscomment>
<isif condition="${pdict.Product.isVariant}">
<link rel="canonical" href="${URLUtils.abs('Product-Show','pid', pdict.Product.variationModel.master.ID)}"/>
<iselse>
<link rel="canonical" href="${URLUtils.abs('Product-Show','pid', pdict.Product.ID)}"/>
</iselse>
</isif>
Did this article solve your issue?
Let us know so we can improve!
Loading
Salesforce Help | Article
Cookie Consent Manager
General Information
Required Cookies
Functional Cookies
Advertising Cookies
General Information
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required Cookies
Always Active
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional Cookies
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising Cookies
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.