feat: translate all pages, UI messages and docs and fix SEO redirects and indexing

This commit is contained in:
alam00000 committed 2026-10-25 12:55:21 +05:30
1 parent 5e019de5ae
commit 4edb1718cc
3344 files changed
+415643 -4759

No files matched your search

+9 -10
View File
@@ -2,6 +2,8 @@ import fs from 'fs';
import path from 'path';
import { execFileSync } from 'child_process';
import { fileURLToPath } from 'url';
import { OFFICIAL_SITE_URL, canonicalBasePath } from './indexing-policy.mjs';
import { createTranslationChecker } from './page-translation.mjs';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
@@ -30,12 +32,10 @@ for (const lang of languages) {
: {};
}
const isPageTranslated = createTranslationChecker(toolsByLang, toCamelCase);
function alternateLangsFor(pageName) {
if (pageName === 'index') return languages;
const translationKey = toCamelCase(pageName);
return languages.filter(
(l) => l === 'en' || Boolean(toolsByLang[l][translationKey])
);
return languages.filter((l) => isPageTranslated(pageName, l));
}
const PRIORITY_MAP = {
@@ -78,10 +78,9 @@ function getPriority(pageName) {
function buildUrl(lang, pageName) {
const pagePath = pageName === 'index' ? '' : pageName;
if (lang === 'en') {
return pagePath ? `${SITE_URL}/${pagePath}` : SITE_URL;
}
return pagePath ? `${SITE_URL}/${lang}/${pagePath}` : `${SITE_URL}/${lang}`;
const root = `${SITE_URL}${canonicalBasePath()}`;
const prefix = lang === 'en' ? root : `${root}/${lang}`;
return pagePath ? `${prefix}/${pagePath}` : prefix;
}
function generateSitemap() {
@@ -170,7 +169,7 @@ function generateSitemap() {
const blogDir = path.join(DIST_DIR, 'blog');
let blogCount = 0;
if (fs.existsSync(blogDir)) {
if (SITE_URL === OFFICIAL_SITE_URL && fs.existsSync(blogDir)) {
const blogFiles = fs
.readdirSync(blogDir)
.filter((file) => file.endsWith('.html'))