Archived topic
Cumulative Layout Shift
5 replies · Started by Anil kumar on November 26, 2022
I just put google ads under the title. Because of this my Cumulative Layout Shift problem is coming. Please solve this problem. Thank you
Can you share the link to the page where the ads been added?
When I have placed ads below the entry title, then I am facing the problem of Cumulative Layout Shift.
And another problem is that I have to put these ads below the entry meta. Means above the feature image.
You can see an article below.
Hi there,
the theme has no control over the spacing your adverts will occupy and if those adverts are inserted without first declaring the space they require then ti will cause CLS.
The most we can suggest is to set a min-height on your ad containers.
You can do that with this CSS:
.adsbygoogle {
min-height: 280px !important;
}
But i suggest you check with your ad provider for the correct code so it sets the height for you.
problem fixed, thank you soo much David.
Second problem, I want to show ads below entry meta and above feature image. Also I want to show this ad only in mobile. please tell me what i have to change in the hook.
Hi Anil,
Can you open a new topic regarding this new problem?
Hope to hear from you soon!