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 { resolve, dirname } from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
|
|
@ -8,7 +8,30 @@ const distDir = resolve(__dirname, '..', 'dist', 'client');
|
||||||
const source = resolve(distDir, 'sitemap-0.xml');
|
const source = resolve(distDir, 'sitemap-0.xml');
|
||||||
const target = resolve(distDir, 'sitemap.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)) {
|
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);
|
cpSync(source, target);
|
||||||
console.log('✅ sitemap.xml created');
|
console.log('✅ sitemap.xml created');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
export const sitemap = false;
|
||||||
import Layout from '@/layouts/Layout.astro';
|
import Layout from '@/layouts/Layout.astro';
|
||||||
import Button from '@components/base/Button.astro';
|
import Button from '@components/base/Button.astro';
|
||||||
import { authService } from '@/lib/authService';
|
import { authService } from '@/lib/authService';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
export const sitemap = false;
|
||||||
import Layout from '@layouts/Layout.astro';
|
import Layout from '@layouts/Layout.astro';
|
||||||
import LoginForm from '@components/auth/LoginForm.astro';
|
import LoginForm from '@components/auth/LoginForm.astro';
|
||||||
import NotificationToast from '@components/base/NotificationToast.astro';
|
import NotificationToast from '@components/base/NotificationToast.astro';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
export const sitemap = false;
|
||||||
import Layout from '@layouts/Layout.astro';
|
import Layout from '@layouts/Layout.astro';
|
||||||
import RegisterForm from '@components/auth/RegisterForm.astro';
|
import RegisterForm from '@components/auth/RegisterForm.astro';
|
||||||
import { authService } from '@/lib/authService';
|
import { authService } from '@/lib/authService';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
export const sitemap = false;
|
||||||
import Layout from '@/layouts/Layout.astro';
|
import Layout from '@/layouts/Layout.astro';
|
||||||
import Button from '@components/base/Button.astro';
|
import Button from '@components/base/Button.astro';
|
||||||
import { authService } from '@/lib/authService';
|
import { authService } from '@/lib/authService';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
export const sitemap = false;
|
||||||
import Layout from '@layouts/Layout.astro';
|
import Layout from '@layouts/Layout.astro';
|
||||||
import { authService } from '@/lib/authService';
|
import { authService } from '@/lib/authService';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
---
|
---
|
||||||
|
export const sitemap = false;
|
||||||
import Layout from '@layouts/Layout.astro';
|
import Layout from '@layouts/Layout.astro';
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue