feat: add sitemap generation and robots.txt

This commit is contained in:
2026-08-02 16:01:21 +02:00
parent eb9db2afff
commit f85488fe2b
5 changed files with 107 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import { describe, it, expect, beforeAll } from 'vitest';
import { execSync } from 'node:child_process';
import { readFileSync, existsSync } from 'node:fs';
describe('sitemap and robots.txt', () => {
beforeAll(() => {
execSync('npm run build', { stdio: 'inherit' });
});
it('generates a sitemap index referencing both locales', () => {
expect(existsSync('dist/sitemap-index.xml')).toBe(true);
const sitemap = readFileSync('dist/sitemap-0.xml', 'utf-8');
expect(sitemap).toContain('https://www.ombrora.com/en/');
expect(sitemap).toContain('https://www.ombrora.com/fr/');
});
it('robots.txt allows all crawlers and points to the sitemap', () => {
const robots = readFileSync('dist/robots.txt', 'utf-8');
expect(robots).toContain('User-agent: *');
expect(robots).toContain('Allow: /');
expect(robots).toContain('Sitemap: https://www.ombrora.com/sitemap-index.xml');
});
});