@@ -45,24 +45,28 @@ const OGImage = new URL(meta.ogImage, Astro.url).href;
4545 crossorigin = " anonymous" ></script >
4646 )}
4747
48- <!-- Google Consent Mode v2 -->
49- { hasGoogleAdSense () && (
50- <script is :inline >
51- // Initialize Google Consent Mode v2
52- window.dataLayer = window.dataLayer || [];
53- function gtag(){ dataLayer .push (arguments );}
54- gtag('js', new Date());
55-
56- // Set default consent state (denied until user consents)
57- gtag('consent', 'default', {
58- ' ad_storage' : ' denied' ,
59- ' ad_user_data' : ' denied' ,
60- ' ad_personalization' : ' denied' ,
61- ' analytics_storage' : ' denied' ,
62- ' functionality_storage' : ' granted' ,
63- ' security_storage' : ' granted'
64- } );
65- </script >
48+ <!-- Google Analytics and Consent Mode -->
49+ { hasGoogleAnalytics () && (
50+ <>
51+ <script async src = { ` https://www.googletagmanager.com/gtag/js?id=${GOOGLE_CONFIG .GA_MEASUREMENT_ID } ` } ></script >
52+ <script is :inline define :vars = { { gaId: GOOGLE_CONFIG .GA_MEASUREMENT_ID }} >
53+ window.dataLayer = window.dataLayer || [];
54+ function gtag(){ dataLayer .push (arguments );}
55+ gtag('js', new Date());
56+
57+ // Set default consent state (granted by default)
58+ gtag('consent', 'default', {
59+ ' ad_storage' : ' granted' ,
60+ ' ad_user_data' : ' granted' ,
61+ ' ad_personalization' : ' granted' ,
62+ ' analytics_storage' : ' granted' ,
63+ ' functionality_storage' : ' granted' ,
64+ ' security_storage' : ' granted'
65+ } );
66+
67+ gtag('config', gaId);
68+ </script >
69+ </>
6670 )}
6771
6872 <!-- Google Tag Manager -->
@@ -76,19 +80,7 @@ const OGImage = new URL(meta.ogImage, Astro.url).href;
7680 </script >
7781 )}
7882
79- <!-- Google Analytics (gtag.js) -->
80- { hasGoogleAnalytics () && (
81- <>
82- <script async src = { ` https://www.googletagmanager.com/gtag/js?id=${GOOGLE_CONFIG .GA_MEASUREMENT_ID } ` } ></script >
83- <script is :inline define :vars = { { gaId: GOOGLE_CONFIG .GA_MEASUREMENT_ID }} >
84- window.dataLayer = window.dataLayer || [];
85- function gtag(){ dataLayer .push (arguments );}
86- gtag('js', new Date());
8783
88- gtag('config', gaId);
89- </script >
90- </>
91- )}
9284
9385 <!-- RSS & Sitemap -->
9486 <link rel =" sitemap" href =" /sitemap-index.xml" />
@@ -103,8 +95,8 @@ const OGImage = new URL(meta.ogImage, Astro.url).href;
10395 <link rel =" canonical" href ={ meta .canonical || canonicalURL } />
10496
10597 <!-- Page Metadata -->
106- <title >{ isArticleMeta (meta ) || Astro .url .pathname .includes (' /authors/' ) ? meta .title : Astro .url .pathname .includes (' /categories/' ) ? ` ${Astro .url .pathname .split (' /' )[2 ].charAt (0 ).toUpperCase () + Astro .url .pathname .split (' /' )[2 ].slice (1 )} Articles | ${SITE .title } ` : ` ${ meta .title } - Technology, Programming & Lifestyle ` } </title >
107- <meta name =" title" content ={ isArticleMeta (meta ) || Astro .url .pathname .includes (' /authors/' ) ? meta .metaTitle : Astro .url .pathname .includes (' /categories/' ) ? ` ${Astro .url .pathname .split (' /' )[2 ].charAt (0 ).toUpperCase () + Astro .url .pathname .split (' /' )[2 ].slice (1 )} Articles ` : ` ${ meta .metaTitle } - Technology, Programming & Lifestyle ` } />
98+ <title >{ isArticleMeta (meta ) || Astro .url .pathname .includes (' /authors/' ) ? meta .title : Astro .url .pathname .includes (' /categories/' ) ? ` ${Astro .url .pathname .split (' /' )[2 ].charAt (0 ).toUpperCase () + Astro .url .pathname .split (' /' )[2 ].slice (1 )} Articles | ${SITE .title } ` : meta .title } </title >
99+ <meta name =" title" content ={ isArticleMeta (meta ) || Astro .url .pathname .includes (' /authors/' ) ? meta .metaTitle : Astro .url .pathname .includes (' /categories/' ) ? ` ${Astro .url .pathname .split (' /' )[2 ].charAt (0 ).toUpperCase () + Astro .url .pathname .split (' /' )[2 ].slice (1 )} Articles ` : meta .metaTitle } />
108100 <meta name =" description" content ={ meta .description } />
109101 { meta .robots ? <meta name = " robots" content = { meta .robots } /> : null }
110102 {
@@ -127,7 +119,7 @@ const OGImage = new URL(meta.ogImage, Astro.url).href;
127119 <!-- Open Graph / Facebook -->
128120 <meta property =" og:type" content ={ meta .type } />
129121 <meta property =" og:url" content ={ canonicalURL } />
130- <meta property =" og:title" content ={ isArticleMeta (meta ) || Astro .url .pathname .includes (' /authors/' ) ? meta .title : Astro .url .pathname .includes (' /categories/' ) ? ` ${Astro .url .pathname .split (' /' )[2 ].charAt (0 ).toUpperCase () + Astro .url .pathname .split (' /' )[2 ].slice (1 )} Articles | ${SITE .title } ` : ` ${ meta .title } - Technology, Programming & Lifestyle ` } />
122+ <meta property =" og:title" content ={ isArticleMeta (meta ) || Astro .url .pathname .includes (' /authors/' ) ? meta .title : Astro .url .pathname .includes (' /categories/' ) ? ` ${Astro .url .pathname .split (' /' )[2 ].charAt (0 ).toUpperCase () + Astro .url .pathname .split (' /' )[2 ].slice (1 )} Articles | ${SITE .title } ` : meta .title } />
131123 <meta property =" og:description" content ={ meta .description } />
132124 <meta property =" og:image" content ={ OGImage } />
133125 <meta property =" og:image:alt" content ={ meta .ogImageAlt } />
@@ -136,7 +128,7 @@ const OGImage = new URL(meta.ogImage, Astro.url).href;
136128 <meta property =" twitter:site" content ={ Astro .site } />
137129 <meta property =" twitter:card" content =" summary_large_image" />
138130 <meta property =" twitter:url" content ={ canonicalURL } />
139- <meta property =" twitter:title" content ={ isArticleMeta (meta ) || Astro .url .pathname .includes (' /authors/' ) ? meta .title : Astro .url .pathname .includes (' /categories/' ) ? ` ${Astro .url .pathname .split (' /' )[2 ].charAt (0 ).toUpperCase () + Astro .url .pathname .split (' /' )[2 ].slice (1 )} Articles | ${SITE .title } ` : ` ${ meta .title } - Technology, Programming & Lifestyle ` } />
131+ <meta property =" twitter:title" content ={ isArticleMeta (meta ) || Astro .url .pathname .includes (' /authors/' ) ? meta .title : Astro .url .pathname .includes (' /categories/' ) ? ` ${Astro .url .pathname .split (' /' )[2 ].charAt (0 ).toUpperCase () + Astro .url .pathname .split (' /' )[2 ].slice (1 )} Articles | ${SITE .title } ` : meta .title } />
140132 <meta property =" twitter:description" content ={ meta .description } />
141133 <meta property =" twitter:image" content ={ OGImage } />
142134 <meta property =" twitter:image:alt" content ={ meta .ogImageAlt } />
0 commit comments