SEO basics for the Salesforce Lightning framework & communities
Salesforce has positioned itself as one of the go-to platforms for high-traffic, enterprise-level ecommerce businesses, with many multinational corporations among its users, including IBM, Amazon, Coca-Cola, and Samsung.
Salesforce has several frameworks and integrations that let webmasters and administrators create custom storefronts and community sites. Each one can add its own set of challenges and nuances to the platform.
Previously, we’ve talked about SFRA (Storefront Reference Architecture) and its potential impact on speed. In this article, we focus on another framework, Lightning – and specifically on Experience Cloud sites, which Salesforce called Communities until 2021.
If you’re interested in Salesforce Commerce Cloud, you might also like our analysis of 1,926 live Salesforce Commerce Cloud websites for SEO issues and trends.
For now, let’s dive into how Salesforce Lightning works and our recommendations for using it with Experience Cloud sites.
What is Salesforce Lightning?
Lightning is Salesforce’s framework for developing responsive applications and sites across its platform, including Experience Cloud sites and B2B Commerce storefronts. Lightning includes:
- The Lightning Component Framework: A UI development framework that removes some technical barriers to development, now built mainly with Lightning Web Components.
- The Lightning App Builder: A visual page builder that uses out-of-the-box and customised Lightning components.
- Experience Builder: Similar to the App Builder, but designed to build Experience Cloud sites (formerly community pages) visually and quickly, without code.
Important note: Lightning-based Experience Cloud sites work differently from, and aren’t compatible with, older Salesforce Tabs + Visualforce sites.
SEO considerations for Experience Cloud sites
Salesforce’s documentation treats SEO for the Commerce Cloud storefront and for Experience Cloud sites as two separate “beasts”. That’s why this article looks solely at the recommendations for Experience Cloud.
So what are the basics Salesforce tells you to follow to make sure your site delivers as much SEO value as possible for your customers and your business – and where do we disagree?
Dissecting Salesforce’s advice
Much of Salesforce’s guidance is solid, although some has become dated, and there are a few recommendations we’d actually do the opposite of. Here’s how each area stacks up.
Setting your preferred domain
Within Experience Builder, there’s a setting for your preferred domain (for example, HTTP or HTTPS, and non-www or www). Set it – it’s also a requirement for content snapshots.
However, this setting won’t ensure that your non-www and non-HTTPS versions redirect to the desired, secure URL. Enforce that with 301 redirects at the DNS level or through your cloud provider. Google Search Console used to have its own preferred domain setting too, but Google retired it in 2019, so the redirects now do the job.
Cached content snapshots
Experience Cloud sites cache a “snapshot” of each public page and serve it to search engines, so crawlers get fully rendered HTML. Current guidance says snapshots update automatically when public content changes, but it’s worth checking the behaviour in your own org.
If your content changes often, such as price, stock, and availability updates, or fresh reviews, refresh the page’s snapshot manually. You can do this from the SEO settings in Experience Builder (Settings → SEO → Content Snapshot). Manual refreshes are limited to once every 24 hours and only cover pages in your standard sitemap.
Robots.txt file configuration
The advice in Salesforce’s Trailblazer Community articles is to disallow all paths in robots.txt, then declare the specific paths you want crawled. Its example, written for a Visualforce page, looks like this:
User-agent: * Disallow: / # hides everything from ALL bots Allow: /<path-prefix-1>/s # add path you want to open to bots Allow: /<path-prefix-2>/s # add path you want to open to bots Sitemap: http://<community_URL>/s/sitemap.xml Sitemap: http://<community_URL>/<sub_path>/s/sitemap.xml
Our default is the opposite. Allow crawling broadly, disallow only the paths and subfolders you don’t want crawled, and keep your XML sitemap limited to the canonical URLs you want indexed. Blocking everything by default makes it far too easy to hide important pages by accident.
Setting up Google Search Console and Bing Webmaster Tools
Salesforce’s documentation may still refer to Google Search Console by its old name, Google Webmaster Tools. Both Search Console and Bing Webmaster Tools need you to verify your site, and Salesforce’s suggested route is to add the meta tag each tool provides to your site’s <head> markup.
The most reliable way, however, is to upload an HTML file or use DNS. That way, a code push that alters the <head> won’t accidentally remove your verification, access, and data.
The meta tag method is the most accessible through Experience Builder, and can be done with a simple copy and paste, meaning the admin or storefront manager doesn’t need developer support. So use it when it’s the only option your admin can ship, but switch to DNS or file verification when you can.
Multilingual Knowledge articles
International SEO can be tricky, especially when so many large websites get it wrong but don’t seem to be affected by it. However, Salesforce’s advice on multilingual Knowledge articles is, in our view, not one to follow.
It recommends keeping translated articles on the same URL as the base-language article, rather than giving them language-specific URLs, with a language parameter in the hreflang link. Its example looks like this:
<xhtml:link rel="alternate" hreflang="language_code" href="page_URL?language=language_code" />
If you’re creating multilingual versions of a page, give each language its own distinct URL and reference them all with reciprocal hreflang annotations, including x-default where it fits your setup, in either the:
- <head>
- XML sitemap
- HTTP header
For more on getting this right, see our international SEO services.
Other Trailblazer notes
Other advice from the Trailblazer support articles can be summarised as:
- Make sure your title tags and meta descriptions are well written and unique to each page.
- Check your XML sitemap only contains the URLs you want indexed.
- Use HTTPS rather than HTTP across the whole site.
- Handle 301 redirects through your DNS provider where you can.
Getting the basics right
Experience Cloud sites can perform well in search, but the default settings won’t get you there on their own. Enforce one canonical host, keep your content snapshots fresh, open up your robots.txt file, verify your properties in a way that survives future releases, and give every language its own URL.
If you need help with SEO on Salesforce, find out more about our Salesforce Commerce Cloud SEO services.