SEO Page Generator Best Practices
When you customize your Commerce web store, it is important you consider the following SEO page generator best practices:
-
Optimize your JavaScript and use minimal AJAX calls to shorten the time it takes to generate the page HTML. The optimized site can help improve ranking on search results pages because faster loading sites are ranked higher than slower sites.
Note:Commerce web stores must load in under 20 seconds.
-
After customizing a page, test it in all main browsers and resolve any JavaScript errors.
Note:You should consider the SEO page generator as another browser that should be tested in addition to Google Chrome, Mozilla Firefox, Safari, Microsoft Edge, or Internet Explorer. See Troubleshooting Your Website for troubleshooting tips and techniques.
-
You should exclude certain elements from SEO page generation. This is useful for embedded, third-party components with external URLs that can consume excessive JavaScript memory or repeatedly poll external URL.
The following example demonstrates this exclusion:
if(!SC.isPageGenerator()){ // Insert non-page generator content here }
-
Use jQuery instead of DOM for better results in the SEO page generator.
-
In the following situations, wrap the code in a statement to exclude it from SEO page generation:
-
You should not initialize UI intensive jQuery plug-ins on the SEO page generator because they can slow your page down.
-
You should not use the
setTimeout()
andsetInterval()
methods on the SEO page generator because they might cause the SEO page generator to timeout. -
You should not use the
animate()
jQuery method on the SEO page generator. -
The Geolocation API is not supported and you must ensure that it is not called in the SEO page generator.
For example, you can wrap your code in a statement similar to the following to indicate that it is only for display in the browser:
if(SC.ENVIRONMENT.jsEnvironment === 'browser'){ // Insert non-page generator content here }
-
-
Use only functions supported by the ECMAScript version 5(ES5) standard.
-
Prerender, a process which pre-loads all elements of a web page before a web crawler accesses it, may not support some trailing commas in your code when the list of parameters in a function ends with a comma.
For example, the following code may generate an error:
function example01(param1, param2, param3,)
The following code will not generate an error:
function example02(param1, param2, param3)
Note:Prerender is supported by the ECMAScript version 5(ES5) standard.
-
If you are making multiple HTTP requests, and you implicitly rely on certain order of execution, your code may be forced to non-expected code paths or states.