feat(web): hreflang alternates, sitemap.xml and robots.txt; staging noindex (MITHOME-116)

src/lib/seo.ts is the single source for page alternates (self canonical
+ hreflang hu/en/x-default), sitemap entries (every page in both
languages, with alternates) and robots rules. Per the user's decisions
every page is announced in both languages regardless of the English
approval status, and staging is never indexed: robots.txt disallows
all, the sitemap is empty and every page carries a noindex meta.

Home and catch-all page metadata now carry alternates and a locale-
correct og:url. Staging smoke SMOKE-09 checks hreflang, canonical,
noindex and robots.txt. Documented in architecture.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Do Siki
2026-09-29 12:36:12 +02:00
co-authored by Claude Opus 5.5
parent facc5db641
commit 2fd5c9bc8b
9 changed files with 162 additions and 4 deletions
+15
View File
@@ -85,6 +85,21 @@ test('SMOKE-08: language switcher opens the same page in the other language', as
await expect(page.getByRole('group', { name: 'Choose language' }).first().getByRole('link', { name: 'Magyar' })).toHaveAttribute('href', '/hu/szolgaltatasok')
})
// MITHOME-116: pages announce both languages (hreflang), and staging is
// never indexed (disallow-all robots.txt, empty sitemap, noindex meta).
test('SMOKE-09: hreflang alternates and staging noindex', async ({ page, request }) => {
await page.goto('/hu/szolgaltatasok')
const origin = new URL(page.url()).origin
await expect(page.locator('link[rel="alternate"][hreflang="en"]')).toHaveAttribute('href', `${origin}/en/services`)
await expect(page.locator('link[rel="alternate"][hreflang="x-default"]')).toHaveAttribute('href', `${origin}/hu/szolgaltatasok`)
await expect(page.locator('link[rel="canonical"]')).toHaveAttribute('href', `${origin}/hu/szolgaltatasok`)
await expect(page.locator('meta[name="robots"]')).toHaveAttribute('content', /noindex/)
const robots = await (await request.get('/robots.txt')).text()
expect(robots).toMatch(/Disallow: \/\s*$/m)
expect(robots).not.toContain('Sitemap:')
})
test('SMOKE-05: empty contact form is blocked client-side without API submission', async ({ page }) => {
let contactPostCount = 0
page.on('request', request => {