fix: harden editorial brand rendering and SEO

This commit is contained in:
pipeline
2026-07-21 20:54:20 +03:00
parent 14d616d1c9
commit 6150ce762d
13 changed files with 158 additions and 52 deletions
+12 -1
View File
@@ -62,9 +62,20 @@
function init() {
var brand = window.__BRAND__ || {};
var pageLocale = document.documentElement.lang || "";
var stored = null;
try { stored = localStorage.getItem("siteLocale"); } catch (e) {}
apply(stored || brand.defaultLocale);
var preferred = stored;
if (pageLocale) {
var locales = window.__LOCALES__ || [];
for (var i = 0; i < locales.length; i++) {
if (locales[i].locale === pageLocale || locales[i].locale.indexOf(pageLocale + "-") === 0) {
preferred = locales[i].locale;
break;
}
}
}
apply(preferred || brand.defaultLocale);
// If a region selector is present (reintroduced later), wire it up.
document.querySelectorAll("[data-locale-switcher]").forEach(function (sel) {
sel.addEventListener("change", function () { apply(this.value); });