Create Catalog and Content URLs

You can configure how your SEO URLs are created for category URLs, category search refinement URLs, and product URLs.

While it is possible to customize folder URLs, for most sites, folders don't have a URL in the storefront. Adding a rule syntax for folders can cause global conflicts with category URLs, because some folders and categories might use the same name, such as gift certificates. For this reason, we recommend not customizing folder URLs unless you have developed landing pages for folders.

When generating static content files, for example, images, css files, and js files, Salesforce B2C Commerce only changes URLs when the corresponding file changes. This is to improve cache efficiency, resulting in better page render times. Prior to Release 15.4, the URL changed whenever the static content cache of the site was invalidated, even though the actual content file did not changed.

The URL page cache ID uses a file fingerprint pattern: /dw98c95d91. Static Image URLs and image URLs in generated sitemaps also include the file fingerprint pattern, which only changes if the file content changes.

If your custom logic for generating static content URLs relies on the presence of the cache ID v-number in the URL, you must change your application. The caching time for static content (time-to-live) is 30 days.

See Configuring SEO URLs.

  1. Select site > Merchant Tools > SEO > URL Rules.
    If you see the Search Support Preferences page instead of the URL Rules page General tab, navigate to Site Preferences > Storefront URLs to enable the module.
  2. On the URL Rules page, click the Catalog|Content URLs tab.
  3. In the Category|Folder URL Rule field, enter the syntax for your URLs.

    See URL Rules URL Syntax.

    You might want to consider the following when creating your rules:

    • If your site has a category depth greater than two or three categories, you might want to use category rather than category-path to keep your URLs brief.
    • If your site has duplicate category names within different parent categories, such as womens > shoes and mens > shoes, you might want to use category-path rather than category so that you don't create conflicts between category names, such as shoes.
    • If you use category-path, you might want to use a delimiter other than a forward slash, so that product names or IDs don't appear part of the path and are read correctly by the search engine.
  4. Select the Enable override with pageURL category|folder attribute (if set) (recommended).

    This lets you add a value to the category|folder Page URL attribute to override specific endpoints. This is useful for cases where different categories automatically generate identical, conflicting URLs; or if you want to use a different value for the folder than the automatically generated value.

    If you do not check this box:

    • The conflict between identical URLs is fixed by assigning an integer to the end of the URLs arbitrarily. For example, electronics/television-1 and electronics/television-2.
    • There is no way to override URLs for specific products. You can still customize URLs, however, by including an attribute with a value specific to each product in the rule itself. For example, you can include the Page URL attribute directly in the rule, instead of as an override.
  5. Select Append trailing slash to category|folder URLs (recommended).
    This automatically adds a trailing slash to all URLs and prevents search engines from seeing URLs with and without the slash as duplicate content and lowering your ranking.
  6. Select Generate URL mappings for offline categories|folders to generate URLs for all offline categories/folders.
    Deselect to avoid the URL generation of offline categories|folders.

    Storefront URL mappings are generated and stored for online/offline categories and folders based on defined rules on each instance type, except for on a Production instance where they go live only via replication.

    Mappings for offline categories/folders are required to have a corresponding rule-based mapping in place if they are going live. Otherwise, a non-SEO URL is created as follows: /on/demandware.store/[…]. This behavior can result in conflicts for hidden categories/folders, which are used to solve use cases other than to go online on Production.

    For example, you want to create temporary offline categories to prepare new product collections, and plan to change the ID/display name after the category is finalized. This setting enables you to avoid the URL generation of all offline categories, and thus avoid the conflict handling that might result in categories with non-SEO-friendly online category URLs. Low-ranked SEOs can result in the loss of traffic. In this type of situation, you should deselect this setting.

  7. Select Enable Category|Folder Search Refinement URLs to configure URLs for search results pages with refinements that are SEO-friendly.

    This enables you to add search refinement information to the URL path instead of the query string.

    1. Click Edit Refinements.
    2. Select the Locale.
    3. In the New Search Refinement field, select the search refinement.
      The list shows all known enabled search refinements. The refinement ID is read only.
    4. Click Create Constant to add a constant.

      Adding a constant is optional. It enables you to easily control search engine crawling for your storefront site, for example:

      User-agent: *, Disallow: /constant/* in the robots.txt file.

      Note:

      While there are other ways to control crawling, such as using meta robots, as follows:

      <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">

      The constant is a fast and easy way.

      You can give the constant a different name for each locale. The constant is added to the path at the position where it's defined, and only if a refinement after this constant is also in the path. For example, brand, constant, color is defined for when we can get URLs such as the following:

      /aBrand/constant/red - /aBrand/

    5. Click Apply.
    Valid category|folder search refinements appear with a value count.

    A defined list of enabled search refinements ensures that categories|folders use the first five valid (defined and not blocked) search refinements, to add corresponding values to the URL path given as a parameter to build a URL.

    The following URL is an example:

    www.my-host.com/New-Arrivals/?prefn1=brand&prefv1=aBrand&prefn2=refinementColor&prefv2=Blau|Grün 

    This could look like the following (configure settings on the General tab > Search Refinement URL Settings section: After, /, /, I ):

    www.my-host.com/New-Arrivals/aBrand/Blau|Grün

    You can also control the position of how mappings are added to the URL and delimiters. All configured character replacements clean the URL, and with this the URL could look like the following (enabled lowercase, character replacement 'ü' -> 'ue') (configure settings on the General tab > Search Refinement URL Settings section: Before, /, _, - ):

    www.my-host.com/abrand_blau-gruen/new-arrivals

    Configure category search refinements in site > Merchant Tools > Products and Catalogs > Catalogs > catalog > Category.

    Configure folder search refinements in site > Merchant Tools > Content > Libraries > library > Edit content > Search Refinement Definitions tab.

    Note: The SiteGenesis application doesn't include folder refinement definitions.
  8. In the Product|Content URL Rule field, enter the syntax for your URLs.

    See URL Rules URL Syntax. You might want to consider the following in creating your rules:

    • There is no need to add the product}content asset ID to the rule, because the ID is required and always added automatically.
    • If your site has duplicate category names within different parent categories, such as womens > shoes and mens > shoes, you might want to use category-path rather than category so that you don't create conflicts between category names, such as shoes.
    • If you use category-path, use a delimiter other than a forward slash, so that product|content asset names or IDs don't appear as part of the path.
  9. Select Enable override with pageURL product|content attribute (if set) (recommended).

    This enables you to add a value to the product|content asset Page URL attribute to override specific endpoints. This is useful for cases where you want to use a different value for the product than the automatically generated value.

    If you don't check this box, there is no way to override URLs for specific products|content asset. You can still customize URLs, however, by including an attribute with a value specific to each product|content asset in the rule itself. For example, you can include the Page URL attribute directly in the rule, instead of as an override.

  10. Select Use '-' as Product ID Separator Instead of '/' (recommended).

    This automatically adds a trailing slash to all URLs and prevents search engines from seeing URLs with and without the slash as duplicate content and lowering your ranking.

    Best Practice: When using dashes in product IDs (for example, 123-456) and setting this flag, the combination can result in inaccessible product pages. This is related to how browsers handle and rewrite dashes in URLs. The generated product URLs from Salesforce B2C Commerce encode the dashes ( - to %2D ), which are included in the product ID, as expected. However, some browsers decode the dashes again, which results in an error (URL resulting in 404). Best practice is to avoid dashes in product ID when using the Use '-' as Product ID Separator Instead of '/' setting.

  11. In the Rule Preview section, you can preview SEO URLs.
    1. Select a category in the Category/Product/Locale field.
      A popup appears instead of a dropdown for site catalogs with more than 1000 categories.
    2. Click the browse button to select a product.
    3. Select the language, for example, Default, French, or English).
    4. Select the encoding (Text Encoded or URL Encoded).
    5. Click Preview.
      The results appear beneath the Rule Preview section entry fields.
  12. When you are satisfied with the appearance of your URLs, click Validate at the bottom of the page to detect any conflicts caused by identical URLs.
    The validation section opens. If there are conflicts, click the conflict value to view conflict details.
  13. Click the Catalog|Content URLs and Global Conflicts sections to expand them.
    B2C Commerce automatically resolves conflicts by adding an integer at the end of the endpoint. If this is acceptable, you don't have to change your syntax. Otherwise, you must either change your syntax or use the Page URL field to override one endpoint out of each identical pair.
  14. Click one of the following buttons:
    • Cancel (manually resolve conflicts): If you want to change your rule syntax to resolve your conflicts.
    • Save (auto-resolve conflicts): If you want to use the automatic resolution provided by B2C Commerce or use the Page URL field to resolve the conflict.
  15. Click the General tab.
    The URL Generation Status section shows a report of when the URL generation job was last run and any conflicts detected between different URLs. The conflicts show when duplicate URLs are being generated.