Add SEO basics: separate EN/RU pages, sitemap, OG banner
Splits the landing page into / and /ru/ so each language can rank on its own, with hreflang links between them; boot.js/main.js now do a real navigation between the two instead of toggling text in place. Adds robots.txt and sitemap.xml, JSON-LD SoftwareApplication markup, Twitter Card tags, and a proper 1200x630 og-image.png in place of the SVG favicon for social previews. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+22
-8
@@ -2,25 +2,39 @@
|
||||
"use strict";
|
||||
|
||||
var root = document.documentElement;
|
||||
var lang = null;
|
||||
var onRuPage = location.pathname.indexOf("/ru/") === 0 || location.pathname === "/ru";
|
||||
var stored = null;
|
||||
var theme = null;
|
||||
|
||||
try {
|
||||
lang = localStorage.getItem("cursorlang.lang");
|
||||
stored = localStorage.getItem("cursorlang.lang");
|
||||
theme = localStorage.getItem("cursorlang.theme");
|
||||
} catch (error) {
|
||||
// Storage refused: what the markup says stands
|
||||
// Storage refused: what the URL says stands
|
||||
}
|
||||
|
||||
if (!lang && (navigator.language || "").toLowerCase().indexOf("ru") === 0) {
|
||||
lang = "ru";
|
||||
// A stored choice always wins, on either page.
|
||||
if (stored === "ru" && !onRuPage) {
|
||||
location.replace("/ru/" + location.search + location.hash);
|
||||
return;
|
||||
}
|
||||
if (stored === "en" && onRuPage) {
|
||||
location.replace("/" + location.search + location.hash);
|
||||
return;
|
||||
}
|
||||
|
||||
if (lang === "ru" || lang === "en") {
|
||||
root.setAttribute("data-lang", lang);
|
||||
root.setAttribute("lang", lang);
|
||||
// No stored choice yet: send a browser set to Russian to the Russian page,
|
||||
// once. Never redirect away from a page a link already pointed at — a
|
||||
// shared /ru/ link, or a crawler fetching either URL directly, stands.
|
||||
if (!stored && !onRuPage && (navigator.language || "").toLowerCase().indexOf("ru") === 0) {
|
||||
location.replace("/ru/" + location.search + location.hash);
|
||||
return;
|
||||
}
|
||||
|
||||
var lang = onRuPage ? "ru" : "en";
|
||||
root.setAttribute("data-lang", lang);
|
||||
root.setAttribute("lang", lang);
|
||||
|
||||
if (theme === "dark" || theme === "light") {
|
||||
root.setAttribute("data-theme", theme);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user