feat: remove unnecessary pages from sitemap
This commit is contained in:
parent
3da1641b86
commit
e1d9677f4f
13 changed files with 30 additions and 1 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,4 +1,4 @@
|
|||
import { cpSync, existsSync } from 'node:fs';
|
||||
import { cpSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import { resolve, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
|
|
@ -8,7 +8,30 @@ const distDir = resolve(__dirname, '..', 'dist', 'client');
|
|||
const source = resolve(distDir, 'sitemap-0.xml');
|
||||
const target = resolve(distDir, 'sitemap.xml');
|
||||
|
||||
const excludeUrls = [
|
||||
'/email-verified/',
|
||||
'/auth/forgot-password/',
|
||||
'/auth/reset-password/',
|
||||
'/auth/verify-email/',
|
||||
'/auth/login/',
|
||||
'/auth/register/'
|
||||
];
|
||||
|
||||
if (existsSync(source)) {
|
||||
// Читаем sitemap
|
||||
let content = readFileSync(source, 'utf-8');
|
||||
|
||||
// Удаляем исключённые URL
|
||||
for (const url of excludeUrls) {
|
||||
const fullUrl = `https://minivan-berlin.de${url}`;
|
||||
content = content.replace(new RegExp(`<url><loc>${fullUrl}</loc></url>`, 'g'), '');
|
||||
}
|
||||
|
||||
// Записываем очищенный sitemap
|
||||
writeFileSync(source, content, 'utf-8');
|
||||
console.log('✅ sitemap-0.xml cleaned');
|
||||
|
||||
// Копируем
|
||||
cpSync(source, target);
|
||||
console.log('✅ sitemap.xml created');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
export const sitemap = false;
|
||||
import Layout from '@/layouts/Layout.astro';
|
||||
import Button from '@components/base/Button.astro';
|
||||
import { authService } from '@/lib/authService';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
export const sitemap = false;
|
||||
import Layout from '@layouts/Layout.astro';
|
||||
import LoginForm from '@components/auth/LoginForm.astro';
|
||||
import NotificationToast from '@components/base/NotificationToast.astro';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
export const sitemap = false;
|
||||
import Layout from '@layouts/Layout.astro';
|
||||
import RegisterForm from '@components/auth/RegisterForm.astro';
|
||||
import { authService } from '@/lib/authService';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
export const sitemap = false;
|
||||
import Layout from '@/layouts/Layout.astro';
|
||||
import Button from '@components/base/Button.astro';
|
||||
import { authService } from '@/lib/authService';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
export const sitemap = false;
|
||||
import Layout from '@layouts/Layout.astro';
|
||||
import { authService } from '@/lib/authService';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
export const sitemap = false;
|
||||
import Layout from '@layouts/Layout.astro';
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue