diff --git a/build.js b/build.js
index 2b82573..753bffc 100644
--- a/build.js
+++ b/build.js
@@ -9,11 +9,20 @@ data.languages.forEach(lang => {
const content = data.content[lang];
let html = template;
+ const fullBasePath = data.siteConfig.basePath;
+ const fullDomain = data.siteConfig.domain;
+
html = html.replace(/{{langCode}}/g, lang);
html = html.replace(/{{title}}/g, content.title);
html = html.replace(/{{metaDesc}}/g, content.metaDesc);
- // 语言链接 - 动态生成
+ // SEO Dynamic Tags
+ const canonicalUrl = `${fullDomain}${fullBasePath}/${lang}/index.html`;
+ html = html.replace(/{{canonicalUrl}}/g, canonicalUrl);
+ // Use a default OG image or generate one (placeholder for now)
+ html = html.replace(/{{ogImage}}/g, `${fullDomain}${fullBasePath}/assets/og-shared.jpg`);
+
+ // 语言链接 - 动态生成 (保持相对路径,兼容性更好)
const langLinksHtml = data.languages.map(l => {
const lContent = data.content[l];
if (l === lang) return `${lContent.langName}`;
@@ -64,3 +73,25 @@ data.languages.forEach(lang => {
fs.writeFileSync(path.join(outputDir, 'index.html'), html);
console.log(`✅ ${lang} 版生成完毕`);
});
+
+// 生成 sitemap.xml
+const sitemap = `
+