How to solve layout shifting issue (CLS) generated after eliminating render blocking in WordPress?

491 views Asked by At

We have developed our website in WordPress using Astra theme and beaver page builder plugin.to increase website score we have used WP-Rocket plugin for optimization. Now WP-Rocket is optimizing CSS and JavaScript and loading CSS and JS files in the end. So because of that beaver page builder styles (Layout CSS) are loading late and it's creating CLS issues in page speed insights. Is there any way to load those layout CSS files at very first load.
Note : For each page these layout CSS files are auto generated by beaver page builder.

1

There are 1 answers

2
Sharanjit Singh On

You can solve the CLS issue easily. If you're using the WP Rocket or any other cache plugin they also created the CSS and cache files. What is CLS. Basically CLS (Cumulative Layout Shift)measures the sum total of all individual layout shift scores for every unexpected layout shift that occurs during the entire lifespan of the page. The score is zero to any positive number, where zero means no shifting and the larger the number, the more layout shift on the page. This is important because having pages elements shift while a user is trying to interact with it is a bad user experience.

How to solve:

For solving the CLS issue we have three solutions:

1. Use CDN

A CDN allows for the quick transfer of assets needed for loading Internet content including HTML pages, javascript files, stylesheets, images, and videos. The popularity of CDN services continues to grow, and today the majority of web traffic is served through CDNs, including traffic. We have various CDN platforms like: https://www.cloudflare.com/

You can also refer to hosting provider, they also provide the CDN for your domain. You can ask to hosting provider for CDN

2. Image Optimization

You have to need to optimize the all site images to deliver the large content in minimum time, you can use the plugin for image optimization as well.

3. Use Preloader

This solution is very effective solution. You can use the loader on your site it solve the CLS issue easily and its working 100%. For loader you can use the preloader plugin.

Hope you understand the Solutions and their requirements.

Thanks