Skip to main content

Configure Page Meta Tag Rules

Learning Objectives

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

  • List the six Salesforce B2C Commerce meta tag scopes.
  • List the three basic meta tag settings.
  • Explain the benefits of using static and dynamic text.
  • Describe how you preview meta tags.

Basic Concepts

Brandon Wilson, Cloud Kicks merchandiser, is ready to configure meta tags for his B2C Commerce storefront. First, he wants to explore some basic meta tag generation concepts—scope and elements—to better craft this important aspect of SEO for his B2C Commerce storefront.

B2C Commerce uses a meta tag rules syntax for page meta tag content generation. Brandon needs to become familiar with this syntax so he can ensure his site has the most effective and unique meta tags to attract shopper interest.

He configures these basic meta tag settings.

  • Scope: What’s the page context?
  • Rule: What are the rule details?
  • Assignment: To what category is the rule assigned?

Scope

Scope defines the context in which B2C Commerce evaluates a page meta tag rule, such as a product or content page or a list of products or content resulting from a search. Each scope uses a specific set of operators. Here are the scopes you can configure in Business Manager.

  • Home page (HP)
  • Product detail page (PDP)
  • Content detail page (CDP)
  • Product list page (PLP)
  • Content list page (CLP)

Product scope, for example, defines rules for meta tags on a product details page. Within a product scope, Brandon uses data from the system or custom product and price objects, and the product image URL. For all scopes, Brandon can create unique meta tags using script operators, such as: or, and, else, if-then, and equals. Each scope can access scope-relative data. For example, Brandon can access the category object for PLP and PDP, but not for CLP or CDP.

Here are the scopes and their operators.

Scope(s)

Operators and Objects

All

  • Script operators: or, and, else, if-then, equals
  • Site context
  • Host context
  • Print a static constant value
  • Original request URL

List pages

  • Search refinements data
  • Search phrase data

Product list and detail pages

  • Category object data

Content list and detail pages

  • Folder object data

Product detail pages

  • Product object data
  • Product price data
  • Product image URL

Content detail pages

  • Content object data

Elements

This part of the process—writing If statements and dynamic expressions—means writing code, which is not Brandon’s forte. He turns to Vijay Lahiri, the Cloud Kicks developer, who’s happy to help.

Vijay Lahiri, Cloud Kicks developer

Vijay can use static or dynamic elements to create unique meta tag content that increases SEO value across pages, products, and URLs. For static elements, he uses B2C Commerce to print static elements directly. He defines dynamic elements within the script syntax, using a format like this: ${dynamic-expression-here}

A dynamic-expression can contain operators and objects.

Configure Static Text

You typically use static text with a dynamic element, such as:

'Some static text with dynamic part ${expression} here.'
  • If expression is empty, the content, 'Some static text with dynamic part here.' is generated.
  • If expression evaluates to 'Dynamic String Value', the content, 'Some static text with dynamic part Dynamic String Value here.' is generated.

For example, for a product details page, Vijay uses this static text with a dynamic expression.

${expression} - Available at Cloud Kicks today! Shop high-end custom sneakers and sports apparel.

The expression value represents the product title, for example, Red Tread Shoes, Alive Cool-T’s, or Happy Racers. It changes based on the product that displays on the page.

When expression is empty (there’s no product title), here’s the meta tag:

<meta name="description" content="- Available at Cloud Kicks today! Shop high-end custom sneakers and sports apparel." />

When expression contains a product title, here’s the meta tag:

<meta name="description" content="Red Tread Shoes - Available at Cloud Kicks today! Shop high-end custom sneakers and sports apparel." />

Configure Static Text in Dynamic Expression

When creating rules, you can print specific static text if something evaluates true. Here’s an example using the robots page meta tag:

${IF SearchRefinement.color OR SearchRefinement.size THEN Constant('noindex,nofollow,noarchive') ELSE Constant('index,follow,archive')},noydir,noodp

When there’s one of the search refinements (size and color) present, the robots meta tag shows this:

noindex,nofollow,noarchive,noydir,noodp

When one of these refinements is not preset, B2C Commerce prints this:

index,follow,archive,noydir,noodp
Note

noodp means no open directory project, while noydir means no Yahoo directory.

Configure Dynamic Text

Dynamic text in meta tags gives you access to certain objects and their values. These objects are product, category, folder, content, and site. You can access the defined system and custom values for these objects, except for defined passwords and other unsupported object value types that look like these.

  • Product.onlineFrom (because Date+Time)
  • Product.longDescription (because HTML)
  • Category.image (because Image)

Here are the supported object attributes.

  • String
  • Text
  • Integer
  • Number
  • Boolean
  • Set of strings
  • Set of integers
  • Set of numbers
  • Enum of strings (only if multiple is not marked)
  • Enum of integers (only if multiple is not marked)

These object attributes are not supported.

  • HTML
  • Date
  • Date+time
  • Image
  • Password

Here’s a script that Vijay develops for Brandon:

Find ${Product.name} in ${Category.displayName} today | ${Site.displayName}

Here’s how it generates content:

Find Happy Racers in Footwear today | Cloud Kicks for the latest  running shoe technologies.

Brandon adds this code into the appropriate field in Business Manager. We get to that next.

Configure Meta Tag Rules

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 meta tag rules.

  1. Open Business Manager.
  2. Select site > Merchant Tools > SEO > Page Meta Tag Rules.
    In Business Manager, the SEO meta tag dashboard.

  3. To see a filtered view of the current meta tags within a scope, click the scope title, or the number in the middle of the scope tile: Product Details Page
  4. On the Dashboard, click New in the Product Detail Page tile.
  5. Configure these settings. 
    • Name the meta tag: ProductDetail01
    • Scope: Product Detail Page
    • Meta Tag ID: description
    • Choose a locale: Default
    • Enter the meta tag rules:
      ${Product.pageDescription} | ${Site.displayName} - Available at Cloud Kicks today! Shop high-end custom sneakers and sports apparel.

      Each rule can contain up to 4000 characters.
    • Enter a description: Description meta tag for Cloud Kicks product detail page
    • Click Save.
      In Business Manager, create a new meta tag rule.

  6. To assign a meta tag, navigate to the respective filtered scope view.
    • Return to the Dashboard and click the Product Details Page tile (or go directly to the Page Meta Tag Rules view).
    • Find the meta tag in the list and click the Assign dropdown.
    • Click Categories.
    • Click Save.

All children inherit the assigned rules. Depending on how large your catalog is, you might have to create multiple rules and override rules on a child category level.

If you got an error when assigning your meta tags, that’s OK. The meta tags in your system might have already been configured. If that’s the case, simply review the settings. This can also be the case when you preview your settings in product details, for example. We get to that next.

Preview Page Meta Tag Rules

Brandon wants to preview his new page metadata. It takes a little sleuthing as he looks in various places throughout Business Manager where meta tag rules live. Here are the Business Manager navigation paths.

Page

Path

Home page rules for sites

Administration > Sites > Manage Sites > SiteID

Detail and list page rules for products

site > Merchant Tools > Products and Catalogs > Catalogs > catalogID

Detail and list page rules for content

site > Merchant Tools > Content > Libraries > libraryID > folderID

Detail page rules for product

site > Merchant Tools > Products and Catalogs > Products > productID 

Detail page rules for content

site > Merchant Tools > Content > Libraries > libraryID > folder > contentID

The user interface for each of these is similar, so Brandon takes a look at the product detail page as an example.

Here’s how to preview a rule.

  1. Open Business Manager.
  2. Select site > Merchant Tools > Products and Catalogs > Products.
  3. Search for a product to test.
  4. Click the product name link.
  5. Click the Page Meta Tag Rules tab.
    In Business Manager, product detail page meta tag rules.

  6. Select a locale: Default
  7. Select the scope: Product Detail Page
    You can search for a product to get a preview for the defined detail page rules.
  8. Take a look at the Page Meta Tag IDs, Rules, and Content.
Note

The rules in this graphic look different from what you configured in this exercise because the meta tags were already configured.

What’s Next?

In this unit, you learned about scopes and elements, both static and dynamic. You learned how to configure and preview your meta tags. Next, you learn how to integrate meta tag generation in your storefront application and how to test and plan for meta tag changes.

Resources

Salesforce Help: Meta Tag Rules: Syntax

Comparta sus comentarios de Trailhead en la Ayuda de Salesforce.

Nos encantaría saber más sobre su experiencia con Trailhead. Ahora puede acceder al nuevo formulario de comentarios en cualquier momento en el sitio de Ayuda de Salesforce.

Más información Continuar a Compartir comentarios