diff --git a/src/components/Block/Alert.astro b/src/components/Block/Alert.astro index 3d8805c..920ac7c 100644 --- a/src/components/Block/Alert.astro +++ b/src/components/Block/Alert.astro @@ -18,7 +18,7 @@ const icon = icons[type]; - diff --git a/src/pages/404.md b/src/pages/404.md index d1d539b..186435f 100644 --- a/src/pages/404.md +++ b/src/pages/404.md @@ -2,6 +2,7 @@ layout: '@layouts/Base.astro' title: Page not found description: 404 page not found +robots: noindex, nofollow --- # 404 Not Found diff --git a/tests/pages/base-page.ts b/tests/pages/base-page.ts index 37971c1..81a5bb3 100644 --- a/tests/pages/base-page.ts +++ b/tests/pages/base-page.ts @@ -33,6 +33,12 @@ export class BasePage { }; } + async goto(path: string) { + await this.page.goto(path, { + waitUntil: 'domcontentloaded', + }); + } + async getMeta() { return this.meta; } diff --git a/tests/spec/404.spec.ts b/tests/spec/404.spec.ts new file mode 100644 index 0000000..641d2e6 --- /dev/null +++ b/tests/spec/404.spec.ts @@ -0,0 +1,12 @@ +import { test, expect } from '@playwright/test'; +import { BasePage } from '@tests/pages/base-page'; + +test.describe('404 page not found', () => { + test('page is noindexed', async ({ page }) => { + const base = new BasePage(page); + await base.goto('404-not-found'); + + const meta = await base.getMeta(); + expect(await meta.robots.getAttribute('content')).toBe('noindex, nofollow'); + }); +});