Archived topic
CLS and LCP issue
13 replies · Started by Keshav on May 28, 2021
Hi,
Website URL: dilsedesi.in
Can you suggest me the solution: I have got this errors "CLS issue: more than 0.25 (mobile)", "CLS issue: more than 0.1 (desktop)" and "LCP issue: longer than 2.5s (mobile)".
What should I do?
Thanks in adavance
Hi there,
One thing Theme related to make an improvement to CLS.
Go to Customizer > General and set the Structure to Flexbox. Then remove your Site Identity Logo, publish the changes and then re-add your logo. This will add the missing width/height attributes to the logo.
Speed wise your biggest hit is the adverts being loaded on the page, use a plugin like Flying Scripts to defer the loading of 3rd party scripts.
Thanks @David for amazing support.
I have set structure to Flexbox and applied all instructions guide by you. Please recheck and let me know if any update needed.
Can you clear your litespeed cache as i am not seeing those changes.
Now cache cleared
Can you add this PHP Snippet to the site:
add_filter( 'generate_logo_attributes', function( $attributes ) {
$data = wp_get_attachment_metadata( get_theme_mod( 'custom_logo' ) );
if ( ! empty( $data ) ) {
$attributes['width'] = $data['width'];
$attributes['height'] = $data['height'];
}
return $attributes;
} );
Added
That fixed the desktop logo issue - which has reduced the CLS.
The remaining CLS is being caused by the Lazy Loading of your featured images .... all the images have width and height attributes but the Placecholder image the lazy loader is using is the wrong size. Can you check with the lazy loader developer to see whats causing that.
Thank you so much.
I have activated responsive placeholder in litespeed cache plugin now.
CLS is now 0
The LCP is due to the first featuered image being lazy loaded - see this topic to stop it being lazy loaded:
Done
The images are still being lazyloaded - talk to Litespeed support about disabling Lazyloading on images with the class: first-featured-image
Okay, Thank you so much
You're welcome