mirror of
https://github.com/elyby/docs.git
synced 2026-11-29 19:03:23 +05:30
Build each locale into its own prefix (/ru/, /en/) with trailingSlash: false, so pages are generated as build/<locale>/<page>.html exactly like the old documentation and the existing URLs (e.g. /ru/api.html) keep working on GitHub Pages without any redirects. The site root is assembled by the postbuild script: - index.html redirects to /ru/ or /en/ based on the browser language - 404.html is copied from the default locale (GitHub Pages only uses the root one) - CNAME, .nojekyll and robots.txt pointing to per-locale sitemaps
38 lines
1.2 KiB
HTML
38 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Ely.by Documentation</title>
|
|
<link rel="alternate" hreflang="ru" href="https://docs.ely.by/ru/">
|
|
<link rel="alternate" hreflang="en" href="https://docs.ely.by/en/">
|
|
<link rel="alternate" hreflang="x-default" href="https://docs.ely.by/ru/">
|
|
<script>
|
|
(function () {
|
|
var ruLike = ['ru', 'be', 'uk', 'kk'];
|
|
var languages = navigator.languages || [navigator.language || ''];
|
|
var target = '/en/';
|
|
for (var i = 0; i < languages.length; i++) {
|
|
var lang = String(languages[i]).toLowerCase().split('-')[0];
|
|
if (ruLike.indexOf(lang) !== -1) {
|
|
target = '/ru/';
|
|
break;
|
|
}
|
|
|
|
if (lang === 'en') {
|
|
break;
|
|
}
|
|
}
|
|
|
|
window.location.replace(target + window.location.search + window.location.hash);
|
|
})();
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<ul>
|
|
<li><a href="/ru/" hreflang="ru">Документация Ely.by на русском</a></li>
|
|
<li><a href="/en/" hreflang="en">Ely.by documentation in English</a></li>
|
|
</ul>
|
|
</body>
|
|
</html>
|