Duplicate content is content that appears on a site for two (or more) URLs without a redirect. Even though the way search engines determine the search rating of a page changes frequently, most search engines decrease the search rating for such content. To have the best search ratings for your page, avoid duplicate content.
Salesforce B2C Commerce automatically handles most out-dated (duplicate) URL mappings without a configuration change. For mappings in the aliases file (host only rules and site paths), however, you can add mappings to enable automatic redirects. B2C Commerce will also use these duplicate resource rules to create your URLs as defined, using the B2C Commerce Script API.
You can configure rules in the Business Manager aliases module to define pipelines that have duplicate URL entry points or are contextual equals for a hostname. You can also define the preferred destination. B2C Commerce generates URLs using the first applicable mapping.
Duplicate URL Rule
The following example
shows how you can mark a pipeline (PiplineA-StartNode
) to
be checked for duplicate URLs (defined within the aliases file as
host-only
or site-path
rule). A redirect
automatically occurs if the URL isn't as defined by the preferred
destination configuration.
There are three destination types,
host
, site-path
, and
pipeline
, with host
and
site-path
requiring a corresponding rule.
From left to right, the first applicable rule is used to redirect duplicate URLs and to generate URLs:
"www.your-hostname.com" :
[
{
"pipeline" : "PiplineA-StartNode"
},
{
"if-site-path" : "eu",
"pipeline" : "PiplineA-StartNode"
},
{
"entry-point-pipelines" : [ "PiplineA-StartNode" ],
"entry-point-destination" : [ "host", "site-path", "pipeline" ]
}
]
With this configuration, all requests that identify the PiplineA-StartNode
pipeline are redirected to the host only destination. The host only URL invokes the
pipeline.
Duplicate Pipeline Rule
The following
example shows how you can mark pipelines (for example,
PiplineB-StartNode
and
PiplineC-StartNode
) as duplicates of, for example,
PiplineA-StartNode
. If either of the two marked pipelines
are called, a redirect automatically occurs to the defined
PiplineA-StartNode
URL:
"www.your-hostname.com" :
[
{
"pipeline" : "PiplineA-StartNode"
},
{
"if-site-path" : "eu",
"pipeline" : "PiplineA-StartNode"
},
{
"entry-point-pipelines" : [ "PiplineA-StartNode", "PiplineB-StartNode", "PiplineC-StartNode" ],
"entry-point-destination" : [ "site-path", "host", "pipeline" ]
}
]
With this configuration, all requests that identify the
PiplineA-StartNode
pipeline are redirected to the site
path destination. All requests that identify
PiplineB-StartNode
or PiplineC-StartNode
pipeline are redirected to the URL defined for
PiplineA-StartNode
, which is the site path
destination URL.
To avoid duplicate resources for your storefront URLs, you should do the following:
Default-Start
pipeline is
invoked.)Default-Start
, which forwards to
Home-Show
. Define a duplicate pipeline rule to handle
this.The following are examples:
Example 1: One Locale and One Hostname
In
this example, your site has one locale and one hostname defined. You have
identified Default-Start
(alias=homepage) and
Home-Show
(alias=home) as duplicate pipelines and
Default-Start
with multiple URLs. Your goal is to avoid
these duplicates and redirect them to the host only URL.
To do this, configure your hostname alias file as follows:
"www.your-hostname.com" :
[
{
},
{
"entry-point-pipelines" : [ "Default-Start", "Home-Show" ],
"entry-point-destination" : [ "host" ]
}
]
This is the new behavior for the following duplicate resource URL requests:
This is the new behavior for the URL generation API:
Default-Start
and host
'www.your-hostname.com': www.your-hostname.com/
Home-Show
and host
'www.your-hostname.com': www.your-hostname.com/
Example 2: Two Locales and Two Hostnames
In this example, your site has two locales
(en_UK
and de_DE
) and two hostnames that
are shared with other sites:
www.your-hostnameA.com
- works without a site
path for this sitewww.your-hostnameB.com
- works with a site path
onlyYou have identified Default-Start
(alias=homepage) and Home-Show
(alias=home) as duplicate
pipelines and Default-Start
with multiple URLs. Your goal
is to avoid these duplicates and redirect them to the host only URL, with
the site path URL as a fallback.
To do this, configure your hostname alias file as follows:
"www.your-hostnameA.com" :
[
{
"locale":"en_UK" },
{
"if-site-path":"de",
"site-path-trailing-slash" : "no",
"locale":"de_DE"
},
{
"entry-point-pipelines" : [ "Default-Start", "Home-Show" ],
"entry-point-destination" : [ "host", "site-path" ]
}
]
"www.your-hostnameB.com" :
[
{
"if-site-path":"uk",
"site-path-trailing-slash" : "no",
"locale":"en_UK"
},
{
"if-site-path":"de",
"site-path-trailing-slash" : "no",
"locale":"de_DE"
},
{
"entry-point-pipelines" : [ "Default-Start", "Home-Show" ],
"entry-point-destination" : [ "host", "site-path"
]
}
]
The new behavior for the following duplicate resource URL requests is as follows:
The new behavior for URL generation API is as follows:
Example 3: Three Locales and One Hostname
In this example, your site has three locales
(en_UK
(site's default locale), fr_FR
,
and de_DE
), and one hostname. You want to support the
site-path both with and without the eu
prefix. You have
identified Home-Show
(alias=home) with multiple URLs and
the PipelineB-Show
pipeline (alias=show-something-b) as
duplicate for the PipelineA-Show
pipeline
(alias=show-something-a). Your goal is to avoid duplicate URLs for
Home-Show
and redirect requests for
PipelineB-Show
to
PipelineA-Show
.
To do this, configure your hostname alias file as follows:
"www.your-hostnameA.com" :
[
{
"if-site-path":"eu/uk",
"site-path-trailing-slash" : "no",
"pipeline":"Home-Show"
},
{
"pipeline":"Home-Show"
},
{
"if-site-path":"eu/fr",
"site-path-trailing-slash" : "no",
"locale":"fr_FR",
"pipeline":"Home-Show"
},
{
"if-site-path":"fr",
"site-path-trailing-slash" : "no",
"locale":"fr_FR", "pipeline":"Home-Show"
},
{
"if-site-path":"eu/de",
"site-path-trailing-slash" : "no",
"locale":"de_DE",
"pipeline":"Home-Show"
},
{
"if-site-path":"de",
"site-path-trailing-slash" : "no",
"locale":"de_DE",
"pipeline":"Home-Show"
},
{
"entry-point-pipelines" : [ "Home-Show" ],
"entry-point-destination" : [ "site-path" ]
},
{
"entry-point-pipelines" : [ "PipelineA-Show", "PipelineB-Show"],
"entry-point-destination" : [ "pipeline"]
}
]
Set the trailing slash to NO
for pipelines
and then enable it.
The new behavior for the following duplicate resource URL requests is as follows:
The new behavior for the URL generation API is as follows:
With this mapping, all pipeline aliases (or category/folder
mappings) are available with two site paths eu
and
eu/[locale]
. If these URLs are not published, for
example, via your sitemap or email recommendation, you don't need to
configure rules for these resources.