Skip to main content
Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.

Explore Meta Tag Rules

Learning Objectives

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

  • Explain how meta tags can help with SEO.
  • Explain the difference between meta title and meta description tags.
  • List four types of meta tags that can help with SEO.
  • Explain rule inheritance.

Why Meta Tags?

Brandon Wilson, an experienced Cloud Kicks merchandiser, is ready to take the final step in optimizing his storefront site for external search engines.

Brandon Wilson, Cloud Kicks merchandiser

His focus in this module is meta tags—small snippets of text that describe a page’s content. You can’t see them on the page because they’re part of the HTML code. Their job is to tell search engines what the page is all about—making them vital for SEO. Search engines use meta tag info for ranking and to display snippets in their search results.

Brandon wants to learn how to optimize his site’s meta tags to highlight the most important elements of his content and make his storefront stand out in search results.

What’s in a Meta Tag?

Meta tags go in the <head> section of an HTML document. If you have lots of pages (as does the Cloud Kicks storefront), that’s a lot of code.

Here are some examples.

<meta name="title" content="Cloud Kicks specializes in high-end custom sneakers and apparel”>
<meta name="description" content="Mid-top mixed leather sneakers for the empowered, in wide-width, too.">

These meta tags impact SEO.

  • Title: Describes the content. It shows up in the search results, and is extracted to show up as anchor text and a title in social shares.
  • Description: Displays below the title tag, providing more details.
  • Robots: Controls the indexing of individual pages, while the robots.txt file prevents search bots from crawling a whole site or section of a site.
  • Alternative text (alt) tag: Improves your SEO while helping both search engines and people learn more about your images.
  • Canonical tag: Tells crawlers which page to prioritize if you have pages that are almost identical or use syndicated content that was republished elsewhere.
  • Hreflang tag: Tells crawlers about different language versions of your multi-language or multi-country site.
  • Headings (h1, h2, h3, and so forth): Provide page structure to improve the user experience and help search engines understand the content.

While alt text, canonical tags, hreflang tag, and head tags are important, in this unit we focus on the first three meta tags listed.

Meta Title

This is the text at the top of a browser. It’s important because search engine algorithms set a value on its keyword, which can attract search engine users to the website. Making this meta tag unique can significantly improve a page’s ranking, drawing more traffic.

Here are some tips.

  • Make the tag clear, descriptive, and not more than 55 characters.
  • If you can, include a keyword in these 55 characters to enhance your SEO, but make sure it adds value. A title with a vague keyword won’t improve results.
  • The title tag is for visitors and search engines. The text should provide clarity and context and make sense to both audiences.

Meta Description

This tag provides a brief description of the page that appears on the search engine results page (SERP). This short description appears as a snippet beneath a link to draw attention to the content and prompt users to click it. While meta descriptions might not impact website rankings, these snippets can influence the click-through rate and traffic when shoppers click the links.

Here are some tips.

  • Provide an accurate description of the content of your page. It’s often what determines whether users click the page.
  • Keep the length to 150–165 characters.
  • Make sure the text is appealing, concise, and relevant.

Robots Meta Tag

This tag defines how crawlers index an individual page and serve it to users in search results. Here’s an example.

<!DOCTYPE html>
<html>
<head> <meta name="robots" content="noindex" /> (…) </head>
<body>(…)</body>
</html>

Use this for pages that are necessary but have little content. Without a meta tag, crawlers automatically index and follow the links on a page.

Use the nofollow setting to not follow the links on a page.

<meta name="robots" content="noindex, nofollow" />

Google requires links to be set to nofollow if they are in a product review. To set an individual link to nofollow, add rel="nofollow" to the link HTML. Use the robots tag to set all the links on a page to nofollow.

Meta Tag Rules

Now that Brandon has learned some meta tag basics, he wants to use Salesforce B2C Commerce to generate them on his storefront pages.

B2C Commerce provides a rule-based meta tag solution to generate and manage storefront content. Here are the types of pages that Brandon targets.

  • Storefront home page
  • Product detail page (PDP)
  • Product listing page (PLP): A category or product search results list page
  • Content detail page (CDP)
  • Content listing page (CLP): A content folder or content list page

To start, Brandon wants to automatically add title and description metadata to the HTML head section of every product detail page. He can import product details that contain SEO settings, or he can enter the SEO product details into Business Manager. B2C Commerce uses this data to automatically build the product detail pages, including the HTML head meta tags.

The graphic shows the Business Manager SEO attributes that are available for product, category, content, and folders. While these fields are not related to the rule-based solution, they can be used inside a rule, for example, ${Product.pageTitle}.

In Business Manager, the SEO product attribute settings.

Rule Inheritance

Brandon could map all his products, categories, folders, and content; but he doesn’t need to. It turns out that he can use B2C Commerce’s lookup order (or inheritance scheme) to minimize the number of rule configurations he must create and maintain.

Rules at the root category (or folder) are visible within all child categories (or folders) and assigned products (or content). Rules are inherited within the current (default) locale context first, before the locale fallback, as defined in language settings.

For example, a B2C Commerce orderable product is typically a standard product (Happy Racers, Blue, Wide, Size 9) that’s a variation of a main product (Happy Racers). Here are some other variations that share the same main product.

  • Happy Racers, Gray, Medium, Size 9
  • Happy Racers, Navy, Medium, Size 8
  • Happy Racers, Green, Narrow, Size 7

You get the idea! Happy Racers come in a variety of colors, widths, and sizes. What’s more, this fabulous sneeker is sold in five countries, so locales are part of the equation.

So, how does inheritance work?

B2C Commerce looks first at the default (or current) locale’s data to generate meta tags. If it can’t find data in that locale, it looks at the next set of data within the B2C Commerce locale fallback schema. Fallback within a locale works the same way.

When generating a meta tag for a product details page, for example, B2C Commerce pulls product data from:

  1. The current product on the page in the current locale, if there’s data
  2. If not, the variation group of the product
  3. If not, the main product
  4. If not, the primary category assigned to the site
  5. The parent category, up to the root category
  6. The next set of locale-based data in the configured locale fallback scheme

Here are the lookup rules for all the page types.

Page Type

Fallback

Product detail page (PDP)

  1. Current product
  2. Variation groups
  3. Main product
  4. Primary category assigned to the site for which the request is processed
  5. Parent categories, up to root
  6. Locale fallback starting at current product in new locale

Content detail page (CDP)

  1. Current content
  2. Primary folder
  3. Parent folders, up to root
  4. Locale fallback starting at current content in new locale

Product list page (PLP)

  1. Current category
  2. Parent categories, up to root
  3. Locale fallback starting at current category in new locale

Content list page (CLP)

  1. Current folder
  2. Parent folders, up to root
  3. Locale fallback starting at current folder in new locale

What’s Next?

In this unit, you learned what meta tags are and which ones are the most useful for SEO. You learned about the types of pages you can target for your meta tags when using B2C Commerce, and how rule fallback works during the meta tag generation process. Next, you learn how to create meta tag rules.

Resources

Share your Trailhead feedback over on Salesforce Help.

We'd love to hear about your experience with Trailhead - you can now access the new feedback form anytime from the Salesforce Help site.

Learn More Continue to Share Feedback