mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-08-30 04:19:27 +00:00
fix: build-time VERSION injection via build.js instead of JS runtime
This commit is contained in:
@@ -119,11 +119,16 @@ async function compile() {
|
||||
const localesDir = path.join(websiteDir, 'locales');
|
||||
const languages = ['en', 'de', 'fr', 'es', 'pt-BR', 'ru'];
|
||||
|
||||
// Read version for build-time injection (SEO: crawlers see real version)
|
||||
const versionJson = JSON.parse(fs.readFileSync(path.join(websiteDir, 'version.json'), 'utf8'));
|
||||
const buildVersion = versionJson.version || '?';
|
||||
|
||||
const englishHtml = {}; // track for join-page cross-ref
|
||||
|
||||
function compilePage(locale, assetPath, lang) {
|
||||
let compiled = templateContent;
|
||||
compiled = compiled.replace(/\{\{ASSET_PATH\}\}/g, assetPath);
|
||||
compiled = compiled.replace(/\{\{VERSION\}\}/g, buildVersion);
|
||||
languages.forEach(l => {
|
||||
compiled = compiled.replace(new RegExp(`\\{\\{SELECTED_${l.toUpperCase()}\\}\\}`, 'g'), l === lang ? 'selected' : '');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user