SEO Page Generator Best Practices
When customizing your SuiteCommerce web store, it's important to consider how your changes might affect the SEO page generator. If the server-side rendering (SSR) malfunctions or fails entirely, partial content may be served to search engines, potentially harming your SEO. Therefore, when you test your changes, treat the SEO page generator like another browser you're testing in.
Site Implementation Aspects and JavaScript Standards
The SEO page generator supports JavaScript as defined in ECMAScript 2024 (ES15). Whenever you develop or update SuiteCommerce extensions, the best way to check compatibility is to test with the SEO Page Generator debug log.
To ensure successful prerendering and optimal SEO results, keep the following best practices in mind:
-
Enable Complete, Finite Page Loads - Ensure your site fully loads and reaches an idle state. Exclude extensions or logic that require continuous polling (like chat widgets) from prerendering, since ongoing activity can cause rendering timeouts.
-
Always Use Asynchronous AJAX Requests - Asynchronous (async) AJAX is standard for web development, so always use async requests to ensure the SEO Page Generator picks up your content correctly.
-
Prefer GET Requests for Data Fetching - When the SEO Page Generator needs to fetch public SuiteCommerce data, use HTTP GET requests. Avoid POST requests for this, since they're usually session-based and not cacheable, so they're unstable and don't work well for SEO-related scenarios. Only use POST requests in exceptional cases, and carefully evaluate whether the content needs to be prerendered.
-
Eliminate JavaScript Execution Errors - All site logic must run without JavaScript errors. If there are errors, prerendering might fail or miss content for search engines.
Excluding Content from the SEO Page Generator
Remember that the SEO page generator's role is to create a version of your web page so a search engine can crawl and index it. Accordingly, there may be customizations to your web store that are designed to help human users, like a chatbot plugin, but these aren't important to web crawlers. In some cases, these customizations may negatively affect web crawlers by making it harder to parse the page, causing extra content to get indexed, or using up crawl budget.
When this happens, you should prevent this JavaScript from being included in the SSR process. To help developers exclude content, the core code and extensibility API includes utility functions for wrapping JavaScript that shouldn't be rendered by the page generator.
The best practice, which is available when writing extensions and modern versions of SuiteCommerce Advanced, is to use a method on the Environment component.
// Using the extensibility API (SuiteCommerce and SuiteCommerce Advanced Aconcagua (R2) or newer
// In an extension entry point file's mountToApp() function
var Environment = container.getComponent('Environment');
if (!Environment.isPageGenerator()) {
// Code that won't run when being rendered on the server
}
If you cannot use the extensibility API, you may use a utility function attached to the SC global variable.
// A simple check
if (!SC.isPageGenerator()) {
// Code that won't run when being rendered on the server
}
// Alternative function
if (SC.ENVIRONMENT.jsEnvironment === 'browser') {
// Code that won't run when being rendered on the server
}
Suggested Content to Exclude from SEO Page Generation
To ensure your pages load fully and on time, exclude any third-party libraries, scripts, or custom logic (whether external or internal) that prevent your page from loading completely or that trigger ongoing activity. The following are usually excluded because they interfere with SSR or don't add any SEO value:
-
Tools and Libraries Not Impacting Page Content - Exclude plugins like chatbots, ads, marketing or analytics scripts, profiling tools, and other third-party libraries that don't contribute to the page's visible or crawlable content.
-
UI-Only jQuery Plugins and Methods - Exclude jQuery features that only create visual effects (like animations or transitions) and don't change meaningful, indexable content.
-
Human-Centric Web APIs - Avoid integrations like the Geolocation API or other browser APIs that bring in personalized or user-specific features that aren't useful for search engines.
-
Real-Time Communication Widgets - Exclude live chat widgets or other communication tools that run in the background, since they can stop pages from reaching a fully loaded state for rendering.
-
External Payment Processor Scripts - Exclude scripts for payment gateways or external payment processors, since they don't add content for SEO and add extra dependencies during prerendering.
Other Considerations
As of today, major search engine bots such as Googlebot can access your site using both mobile (touch-enabled) and desktop (non-touch) user agents. Although prerendered content is typically served in 'no-touch' (desktop) mode by default, this may evolve as search engine technologies and crawling methods advance. To ensure the best accessibility and search performance, optimize your site holistically for all device types, rather than focusing solely on either mobile or desktop experiences.
Limits
There are several governance limits that apply to any page sent for SSR, including memory usage, CPU usage, and execution time. If the page generator stops running because of one of these limits, it usually means there's a problem with the JavaScript, like recursion, forgotten timers, unresolved callbacks, or too much DOM querying.
-
A web page should load as quickly as possible, but the page generator usually times out after 10 seconds. To prevent this, the service can also limit the number of subrequests your page triggers.
-
Ensure you stay under 500 MB of memory usage through the site execution.
-
If the page generator can't finish SSR, it returns the generated content as-is, marked with a 206 (Partial Content) status code.