From 4075abcb9383563697a275846d993125bc8da4e9 Mon Sep 17 00:00:00 2001 From: Ann Chapman Date: Fri, 8 Aug 2025 11:28:42 -0500 Subject: [PATCH 1/2] set meta locale tag on 404.html --- 404.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/404.html b/404.html index 099d13c6..ff044d5a 100644 --- a/404.html +++ b/404.html @@ -47,6 +47,13 @@ homeBtn.textContent = ph.gohome; } + // Set the locale meta tag + const metaLocale = document.createElement('meta'); + const head = document.querySelector('head'); + metaLocale.name = 'locale'; + metaLocale.content = locale; + head.appendChild(metaLocale); + sampleRUM('404', { source: document.referrer }); }); From c9d5444ba1b672ce340c21a1a5bcdd1aa2562205 Mon Sep 17 00:00:00 2001 From: Ann Chapman Date: Fri, 8 Aug 2025 11:51:56 -0500 Subject: [PATCH 2/2] move locale logic outside of listener --- 404.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/404.html b/404.html index ff044d5a..d24d6aea 100644 --- a/404.html +++ b/404.html @@ -22,6 +22,13 @@ const locale = getLocaleFromPath(); const ph = await fetchPlaceholders(`/${locale}`); + // Set the locale meta tag + const metaLocale = document.createElement('meta'); + const head = document.querySelector('head'); + metaLocale.name = 'locale'; + metaLocale.content = locale; + head.appendChild(metaLocale); + window.addEventListener('load', () => { if (document.referrer) { const { origin, pathname } = new URL(document.referrer); @@ -47,13 +54,6 @@ homeBtn.textContent = ph.gohome; } - // Set the locale meta tag - const metaLocale = document.createElement('meta'); - const head = document.querySelector('head'); - metaLocale.name = 'locale'; - metaLocale.content = locale; - head.appendChild(metaLocale); - sampleRUM('404', { source: document.referrer }); });