Create Home Page Links

If your host is listed in site > SEO > Aliases, and only one locale is used for the site, you can create links to the home page that are search-friendly because they don't require additional information to determine the locale. In this case, you can use a hostname-only URL instead of generating links to the homepage via a Salesforce B2C Commerce pipeline. If you have a multi-locale site, ignore the rest of this topic.

For example, for a home page link in the top navigation bar, instead of generating the link via pipeline:

<a href="${URLUtils.http('Home-Show')}">home</a>

Which results in the full B2C Commerce URL being shown:​Sites-SiteGenesis-Site/​default/Home-Show.

Instead, directly reference the host name in a link such as the following:

<a href="http://${request.httpHost}/">home</a>

Review code that is taken from the SiteGenesis application and new custom code. This is because SiteGenesis is based on a multi-locale site and uses pipeline to generate home page links.

Check that the home page link is generated via the pipeline Home-Show in the following SiteGenesis templates:

When these templates are used in a custom application, the code must be modified to deliver the hostname-only URL.

Issuing Hostname-Only Requests

Hostname-only requests can be issued with or without one or more parameters, with the following default destinations:

Hostname only Default destination Example
Without parameters Default-Start
With one or more parameters RedirectURL-Start, enabling you to use the mapping rules functionality.

The configuration value apply-to-host-only-request-with-params enables you to forward hostname requests with parameters to the configured pipeline, for example:

"":[{"pipeline":"Home-Show", "apply-to-host-only-request-with-params":"true"}] 

This example forwards the requests and to the Home-Show pipeline and preserves the original URL parameters.

Related Links

Configuring SEO URLs

Dynamic Mappings

Hostname Aliases