Configure SEO URLs

Learning Objectives

After completing this unit, you’ll be able to:

  • Explain the order in which SEO URL configurations move from one instance to another.
  • Describe how to create a product or category URL rule.
  • List three things you need to consider when configuring SEO URL rules.
  • Explain why it’s important to localize URLs.

Get Started with SEO URLs

Brandon Wilson, Cloud Kicks merchandiser, can’t wait to get started. When his Salesforce B2C Commerce site was first provisioned, URL Rules were automatically enabled. He now has permission to access the URL Rules module, so he can create and edit SEO URL configurations. He plans to configure and test URL rules in a sandbox before he exports them to staging. His administrator will help him replicate them to production.

Configure General Settings

Brandon wants to convert all characters to lowercase to prevent search engines from counting URLs with different capitalizations as duplicate content. He does this because he has brands or products with the same spelling, but different capitalization. This has no effect on product IDs (abc123 versus ABC123). He also wants to replace white space with another character to make them more human readable.

In this module, we assume you are a B2C Commerce merchandiser with the proper permissions to perform these tasks. If you’re not a B2C Commerce merchandiser, that’s OK. Read along to learn how your merchandiser would take these steps in a sandbox instance. Don’t try to follow our steps in your Trailhead Playground. B2C Commerce isn’t available in the Trailhead Playground.

If you have a sandbox instance of B2C Commerce, you can try out these steps in your sandbox. If you don’t have a sandbox, ask your manager if there is a sandbox that you can use.

Here’s how to configure general SEO URL settings.

  1. Open Business Manager.
  2. Select site > Merchant Tools > SEO > URL Rules.
  3. Click the Settings tab.
    Business Manager SEO URL Settings tab

  4. Select Lower Case to make sure you don’t create multiple URLs with various cases of the same text.
  5. Define how B2C Commerce replaces whitespace: %20 (URL Encoding).
    • You can also use plus, underscore, minus, and period.
    • Avoid using the minus sign in product or brand names if you also use it as a delimiter within SEO Search Refinement URLs. The minus sign is the same as a hyphen. You might end up with duplicate URLs that appear as issues in the General tab Conflict section.
  6. Click Apply.

Configure the Rules

Great products drive sales, but how do shoppers find them? A product- or category-specific URL can get a shopper to the exact product or category fast. Brandon’s understanding of his catalog structure helps him construct better rules. Remember, a rule tells B2C Commerce what pattern of information to display for the URL.

Here are some things he considers when creating rules.

  • If a site has a category depth of more than two or three categories, use category instead of category-path to keep the URLs brief.
  • If a site has duplicate category names within different parent categories, such as womens > shoes and mens > shoes, use category-path instead of category so 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 product names or IDs don't appear as part of the path and are read correctly by the search engine.
  • You don’t need to add the product|content asset ID to the rule because the ID is required and B2C Commerce always adds it automatically.

Brandon follows these simple rules when he defines his SEO URL rules.

  • The mapping can be empty.
  • The mapping segments can contain the characters a-z, A-Z, -, and _.
  • The mapping can contain one / with the restriction that both segments can't be empty.

He can customize folder URLs, but his sites don’t have folder URLs in the storefront. Adding a rule syntax for folders could cause global conflicts with his category URLs, because some folders and categories might use the same name, such as gift certificates.

Here’s how to create an SEO URL rule.

  1. Open Business Manager.
  2. Select site > Merchant Tools > SEO > URL Rules.
  3. Click the Catalog (or Content) URLs tab.
    Business Manager SEO URL Catalog URLs tab

    Remember, products in a catalog only display on the storefront if they are assigned to a category.
  4. Create a category rule.
    • The source is a category, so enter this in the Category URL Rule field:
      [ [ constant, const ], /, [ category-path, [ attribute, ID ], - ]]
    • This defines a constant and the category path to be used in every URL. The attribute in this rule is an attribute of the category, so it uses the category ID.
  5. Create a product rule.
    • The source is a product, so use category as the source instead of category-path:
      [ [ constant, const ], /, [ category, [ category-path, [ attribute, ID ], - ] ]]
    • The constant const111 applies as a constant and category applies as already specified in the category rule, as follows:
      [ [ constant, const111 ], /, [ category] ]}
    • When you define a product rule, it retains the category that you defined in the category rule. Remember, a product must be assigned to a category to appear on the storefront.
      For example, if you specify the category rule to result in /const222/shoes/ and then use this [ [ constant, const111 ], /, [ category], /, [ productID ] ] to define a product rule (with a product ID 008884303996), the product info is tacked onto the category with this result: /const111/const222/shoes/008884303996.html
      Here's another way to look at it:
      constant const111 category product ID
      const111 const222 shoes 008884303996.html
  6. Configure these for even better URLs:
    • Enable override with the pageURL product|content attribute: This lets you add a value to the product|content asset Page URL attribute to override specific endpoints. Use this when different categories automatically generate identical, conflicting URLs; or if you want to use a different value for the folder than the automatically generated value.
    • Append a trailing slash to category|folder URLs: This automatically adds a trailing slash to all URLs. It prevents search engines from seeing URLs with and without the slash as duplicate content and lowering your ranking.
    • Generate URL mappings for offline categories|folders: This defines if mappings are also generated for offline categories/folders. When enabled, you see  possible conflicts. When disabled, you prevent conflicts with hidden categories/folders.
    • Enable Category|Folder Search Refinement URLs: Use this to add search refinement information to the URL path instead of the query string.
    • Use - as the Product ID Separator Instead of /: This automatically adds a - (hyphen) between product name and product ID instead of a /.
      Set this to / when you have product SKUs or content IDs that contain hyphens and use Chrome. (See the corresponding conflict on the General tab.)

Brandon can use a variety of attribute value types (of category, product, folder, or content asset data) when creating his rule, such as these:

  • Integer
  • Set-of-Int
  • Enum-of-Int
  • String
  • Set-of-String: Such as a product description, or an array of content
  • Enum-of-String: Array of text, such as product details

Examples include a product ID (integer), lists of product IDs (set-of-int), product description (string), a matrix of product details (enum-of-string).

Localize

Cloud Kicks, like many merchants, is an international company that localizes its URLs. He wants to make sure locales appear in the URLs in a certain way, to satisfy country and language-specific customs and requirements.

Here’s how he does it.

  1. Open Business Manager.
  2. Select site > Merchant Tools > SEO > URL Rules.
  3. Click the Settings tab.
    Business Manager, SEO URL Settings, locale mapping

  4. Select Path.
    The locale appears as part of the URL path. This lets you specify mappings between the locale names you enter to be used in the URL and the locales recognized by Salesforce B2C Commerce. You can define one or two values for the locale.
  5. With one value, the resulting URL looks like this: http://cloudkicks.com/en/mens
  6. With two values, you specify the first value, the '/' character, and then the second value, for example, de/DE. The resulting URL looks like this: http://cloudkicks.com/de/DE/mens
    • You can use only one backslash.
    • An alternative to this feature is to define mappings in the aliases file.

Brandon can also use these locale mappings.

Use...

When you...

None

Don’t want the locale to appear in theURL.

Hostname

Want the locale to appear as part of the host name. You create top-level hostname aliases in the alias file. You define the host names and select a locale.

URL Parameter

Want the locale to appear as a URL parameter. You define the name of the parameter and the value of each locale. The resulting URL looks like this:

http:/cloudkicks.com/home?lang=en_US

Specify mappings between the locale name used in the URL and the actual locale (for example, en > default).

Next Steps

In this unit, you learned how to create an SEO URL rule and configured important settings. Next, you learn how to work with SEO URL search refinements.

Resources