问题原文
原帖链接 · gvanto · CC BY-SA 4.0
In Google Search Console > Core Web Vitals, I have many 'poor' pages, and the problem GSC is saying is Cumulative Layout Shift CLS.
Doing a page speeds insights (PSI) analysis, shows a very poor (26%) performance for mobile: 0.53
Looking at this helpful post on how to diagnose the problem (see where CLS is occurring), I find the largest layout shift as follows:
(This block - call it block A - was also shown in the PSI report). In mobile mode, the sidebar on the RHS sits above block A. So I thought that according to this post, the problem was the (adsense) ad causing the shift, so I placed a fixed-size (CSS) div block around the ad, but it seems to not have solved the shifting issue. I've also ensured all images have explicit sizes set (since they're using lazy loading too).
Any help would be greatly appreciated at this stage as it is causing a lot of frustration and impacting SEO performance.
(Edit): As for reducing unused JS, in chrome dev tools > Coverage, FB Connect and Google Adsense have huge amounts of unused JS code:
Also PageSpeed Insights is showing similar results:
So goal would be to completely defer the loading of FB connect / twitter / Adsense JS code until page has loaded completely. https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/loading-third-party-javascript#how_do_you_load_third-party_script_efficiently
已采纳解答
原帖链接 · Mike Ciffone · CC BY-SA 4.0
You've got a lot going on here that is contributing to your problems. At face value, it seems like you're spending an excessive amount of time on script evaluation.
This div is responsible for your layout shifting:
<div class="cell small-12 medium-8 large-9 small-order-2 medium-order-1 large-order-1 panel-content">
Ultimately, there is way too much going on to say definitively. I would start by the following:
- Get rid of any render blocking assets - you've got 4-5 and I think they're all CSS.
- Take advantage of resource hints such as
preconnectordns-prefetchto establish early connections to important third-party origins. - Figure out how to spend less time evaluating scripts, that's where the browser's main thread is spending a majority of its time.
- Follow the optimization advice provided by PageSpeedInsights and make sure to do all of them.
I wrote an answer to a similar question you might find useful about determining the cause of CLS.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
