From 7fa51fa4b7831f5ab2391d4a04f3a1ec107f9f00 Mon Sep 17 00:00:00 2001 From: alexandrev-tibco Date: Wed, 27 May 2026 14:54:39 +0200 Subject: [PATCH] Fix blog mobile LCP: only load adsbygoogle.js when inArticleSlot is set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit adsbygoogle.js (28KB) + consent framework (126KB + 32KB) were loading on every blog page despite inArticleSlot being empty — no ads shown, 186KB of JS downloaded for nothing. Mobile LCP: 11.1s → expected ~2-3s. Keep the google-adsense-account meta tag for account verification. Script now conditional on both client AND slot being configured. Co-Authored-By: Claude Sonnet 4.6 --- site/layouts/partials/adsense/head.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/site/layouts/partials/adsense/head.html b/site/layouts/partials/adsense/head.html index 43e4a855..8779071c 100644 --- a/site/layouts/partials/adsense/head.html +++ b/site/layouts/partials/adsense/head.html @@ -1,5 +1,8 @@ {{- $client := .Site.Params.adsense.client -}} +{{- $slot := .Site.Params.adsense.inArticleSlot -}} {{- if and $client (ne hugo.Environment "development") -}} + {{- if $slot -}} + {{- end -}} {{- end -}}