Skip to main content

Prerendering Best Practices

Prerendering is an optimization technique that generates static HTML pages from dynamic content to improve website performance. The following best practices help you get the most out of Prerendering.

Selective Prerendering

To maximize the benefits of prerendering, target specific areas of your website that will gain the most from this optimization technique. Typically, these are high-traffic pages or sections featuring dynamic content that seldom changes. By focusing on these areas, you ensure efficient use of resources and faster load times for your users.

Domain Configuration

Be very careful when configuring the domains for prerendering. Incorrect settings can result in caching problems and the delivery of outdated content. Make sure the specified domains are accurate and correspond to the sections of your site that you intend to prerender.

Use the API for Caching and Recaching

Take advantage of the prerendering service's API to manually cache or recache pages. This ensures that crawlers always access up-to-date content, and allows you greater control over your caching strategy.

Configure Ignored Parameters

Though a default set of tracking parameters to be ignored is provided, you may need to customize this list based on your unique needs. For instance, if your website uses specific URL parameters for user sessions or tracking, add these to the list of parameters that should be ignored during prerendering.

Dead links negatively affect both your SEO rankings and the cost of prerendering. Regularly scan your website for dead links and either remove them or update them to point to active pages. This improves user experience and ensures you're not incurring extra charges for prerendering pages that don't contribute to your site's value.

Implement User-Agent String Detection on Your Origin Server

Customize your origin server to detect user-agent strings. This enables more granular control over the content you serve, allowing you to tailor user experiences based on the device or browser they are using. For example, you could serve a lighter version of your website to browsers that are known to have performance constraints.

Regularly Review Prerendering Performance Metrics

Examine the performance metrics generated by the prerendering service. These metrics provide valuable insights into user experience and identify areas for further optimization. Make a habit of checking these metrics at regular intervals to stay ahead of any issues.

Manage Cache on Your Origin Server

Effective cache management on your origin server is crucial for optimizing dynamic content. Coordinate the cache settings on your origin server with the prerendering settings to ensure that users get the most up-to-date content without compromising on load times.

Return the Correct Status Codes to Crawlers

Incorporate special meta tags in the <head> section of your HTML pages to specify the HTTP status codes that should be returned to web crawlers. This is particularly useful when your REST calls result in HTTP status codes other than 200.

<meta name="prerender-status-code" content="404">
<meta name="prerender-status-code" content="301">
<meta name="prerender-header" content="Location: http://www.example.com">

Indicate When Pages Are Ready to Be Saved

Notify the prerendering service exactly when your pages have finished loading and are ready to be saved. This can be achieved using the following HTML and JavaScript code snippets:

<script> window.prerenderReady = false; </script>
window.prerenderReady = true;