feat(website): auto-copy google and indexnow verification files during build

This commit is contained in:
Timo
2026-07-02 17:38:15 +02:00
parent 3392f0b3a7
commit 223c3949d2
3 changed files with 20 additions and 1 deletions
@@ -0,0 +1 @@
4650678bb36b488d8f64343a67f1b931
+18 -1
View File
@@ -314,7 +314,7 @@ async function compile() {
}
}
// ── 5. Copy generic static files ──
// ── 5. Copy generic static files and verification files ──
const genericFiles = ['robots.txt', 'sitemap.xml', 'site.webmanifest', 'version.json'];
for (const file of genericFiles) {
const src = path.join(websiteDir, file);
@@ -322,6 +322,23 @@ async function compile() {
if (fs.existsSync(src)) { fs.copyFileSync(src, dest); }
}
// Auto-copy Google verification files and IndexNow/txt key files from website source to www root
const websiteFiles = fs.readdirSync(websiteDir);
for (const file of websiteFiles) {
const filePath = path.join(websiteDir, file);
if (fs.statSync(filePath).isFile()) {
// Match google[hex/alphanumeric].html or any hex/uuid txt file (e.g. 4650678bb36b488d8f64343a67f1b931.txt)
const isGoogleVerification = /^google[a-zA-Z0-9_-]+\.html$/i.test(file);
const isIndexNowVerification = (/^[a-zA-Z0-9_-]{8,}\.txt$/i.test(file) || /^[a-f0-9-]{32,36}$/i.test(file)) && file !== 'robots.txt';
if (isGoogleVerification || isIndexNowVerification) {
const dest = path.join(wwwDir, file);
fs.copyFileSync(filePath, dest);
console.log(` Copied verification file: ${file}${file}`);
}
}
}
// ── 6. Copy assets ──
console.log('Copying assets...');
const srcAssets = path.join(websiteDir, 'assets');
+1
View File
@@ -0,0 +1 @@
google-site-verification: google157cb8453d13ccdc.html