diff --git a/scripts/build_every_lang.sh b/scripts/build_every_lang.sh
index f458003..730eb1f 100755
--- a/scripts/build_every_lang.sh
+++ b/scripts/build_every_lang.sh
@@ -7,6 +7,7 @@ for lang in public/locales/*; do
continue
fi
export VITE_DEFAULT_LANG=$lang
+ export VITE_BASE_URL="/$lang/"
echo "Generating $lang"
npm run build -- --outDir "build/$lang" --base "/$lang"
done
diff --git a/vite.config.js b/vite.config.js
index f188d7d..d827766 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -20,6 +20,16 @@ const htmlPlugin = async (env) => {
...translationsEn,
...translationsTarget,
};
+ const baseUrl = env.VITE_BASE_URL ?? "";
+ const canonicalLinks = ``;
+ const alternateLinks = Object.keys(languages)
+ .map(
+ (lang) =>
+ `\t`,
+ )
+ .join("\n");
+ const defaultAlternateLink = `\t`;
+ const seoLinks = `${canonicalLinks}\n${alternateLinks}\n${defaultAlternateLink}`;
return {
name: "html-transform",
transformIndexHtml(html) {
@@ -32,6 +42,10 @@ const htmlPlugin = async (env) => {
.replace(
//,
``,
+ )
+ .replace(
+ //,
+ seoLinks,
);
},
};