Subscribe to Our Newsletter

x

Page Load Optimizations (Lazy Loading)

How does Lazy loader work?

The Lazy loader is a JS library that renders content in front of visitors as quickly as possible. Lazy loader allows browser to load only the main content (the first post) and the minimal set of stylesheets.

All the rest content must be marked as lazy-objects so that browser can ignore it at the first rendering.

When the main content will be loaded, Lazy loader will find all marked lazy-objects and load them gradually (by downloading stylesheets and javascripts asynchronously, processing DOM elements to prevent them from blocking page rendering).

 

How to mark page objects as lazy-objects:


Above-the-fold content first

Browser should render the critical part of the page (the first post) immediately and defer the rest of them. Add lazy-loading class to the rest content sections that will hide these elements.

Before: 

<div class="search">    <form action="/core/search/">        ...    </form></div>

After: 

<div class="search lazy-loading">    <form action="/core/search/">        ...    </form></div>

Including CSS

This method of loading CSS will deliver usable content to visitors much more quicker than the standard approach. Critical CSS can still be served with the usual blocking approach (or you can inline it for ultimate performance) and non-critical styles can be progressively downloaded and applied later in the parsing / rendering process.

Before:

{% css_include 'frontpage_features' %}

Afer:

{% lazy_css_include 'frontpage_features' %}

Including inline Javascript

The loading and execution of scripts that are not necessary for the initial page render may be deferred until after the initial render or other critical parts of the page have finished loading.  Just change type attribute from text/javascript to text/lazy-javascript, so browser can ignore it at the first rendering. You can insert inline script in any part of the page, all lazy-scripts will be sorted by their priority attributes upwards.  For non-critical scripts 4 and higher priority is recommended. 

Script loading sequence:

Priority | Scripts      0  | require.js, amd_config, sprintf      1  | Settings, userSettings, Bootstrap, etc      2  | JS Templates, site features      3  | Analytics      4  | Third-party JavaScript      5  | Facebook API, Twitter API      6..| Any custom javascripts

Before:

<script type="text/javascript">    alert("example");</script>

After:

<script type="text/lazy-javascript" priority="5">    alert("example);</script>

Including external Javascript

External blocking scripts force the browser to wait for the JavaScript to be fetched,
which may add one or more network roundtrips before the page can be rendered.
Just change src attribute to data-src.

Before:

<script type="javascript" src="https://www.rebelmouse.com/embed/Huffpostgreen/elite.js"></script>

After:

<script type="text/lazy-javascript" priority="5" data-src="https://www.rebelmouse.com/embed/Huffpostgreen/elite.js"></script>

 

By default our pages are structured on they way that we can disable or enable Lazy loader in engine_settings, but we highly recommend to keep it enabled. It helps at achieving higher page speed scores.

How to Include Interactive Elements in Posts

Enhance your articles with rich and creative media

Every article is a fresh chance to grab new readers and nurture loyal followers. This is why we give creators every opportunity to build content rich with media elements that enhance every reader's experience.

Add More Layers to Your Content

You can easily add interactive elements, like charts, to posts on our platform. For example, if you need to embed iframe code into a post, this can be done via our Add Media Bar. To do so, click the code icon (< >):

A text box will appear so you can insert your code:

Embedded Code Across Platforms

One important thing to keep in mind is that Google AMP, AppleNews, and Facebook Instant Articles will not always support embedded code. So if you use an iframe, it's best to turn off distribution to those channels for that particular post. If you have a lot of posts that require embedded code, this could be problematic for growth across those important platforms.

If you do want to use an iframe on a post destined for Google AMP distribution, it can be possible if the iframe is not at the top of the page or within the first 75% of the viewport when the page is scrolled to the top (whichever is smaller). AMP is a fast technology designed for mobile users and iframes are loaded using arbitrary timing that AMP's technology cannot ensure. For this reason, it's suggested that iframes be included in places that are not visible by users upon load.

If you have an article that needs to include an iframe at the top of the page, or within the first 75% of the viewport, AMP can be turned off for that individual article within Entry Editor.

If you don't need an interactive chart to be interactive in nature, can turn it into an image and upload it directly to your post. This way it will work on all platforms, including Google AMP, Apple News, and Facebook Instant Articles. This option, when possible, is ideal to ensure you're optimized for page speed.

Take Advantage of Shortcodes

Another great way to embed media is through our shortcodes functionality. Click here to learn more about shortcodes. Shortcodes can also inserted using the Add Media Bar. Click the brackets icon ([ ]) to choose the shortcode you want to use.

Here's an example of a chart on an article page that's been inserted using a shortcode:

If you have any questions about how to add interactive elements to your content, please email support@rebelmouse.com or talk to your account manager today.

Shortcodes Dashboard: Dynamic Media in Just a Few Clicks

Create multidimensional content with easy-to-find shortcodes

We believe static media is dead, and that every piece of content should be multidimensional and engaging. This is why our platform enables creators so they can add dynamic media to their content in easy and efficient ways.

One simple way to add interactive content to any post is through the use of shortcodes. Shortcodes are small snippets of code that are easier to remember than longer sequences. They typically will activate a feature or embed media into an article.

Keep reading... Show less
Subscribe to Our Newsletter