feat: add BaseLayout with SEO head tags and theme init script

Canonical/hreflang/OG tags derived from the locale dictionary, plus a
pre-paint script applying data-theme from localStorage or system
preference.
This commit is contained in:
2026-08-02 15:54:42 +02:00
parent 2606508713
commit 1d65bb7aa8
6 changed files with 238 additions and 21 deletions
@@ -457,14 +457,16 @@ describe('BaseLayout SEO tags and theming', () => {
expect(en).toContain('prefers-color-scheme: light');
});
it('links the global stylesheet', () => {
it('applies the global stylesheet (inlined or linked)', () => {
const en = readFileSync('dist/en/index.html', 'utf-8');
expect(en).toMatch(/<link rel="stylesheet"[^>]*href="[^"]+\.css"/);
const hasInlineStyle = /<style>[\s\S]*--accent[\s\S]*<\/style>/.test(en);
const hasStylesheetLink = /<link rel="stylesheet"[^>]*href="[^"]+\.css"/.test(en);
expect(hasInlineStyle || hasStylesheetLink).toBe(true);
});
});
```
Note: from this task on, tests call `npm run build` themselves via `beforeAll`, so `npm run test` alone is sufficient going forward.
Note: from this task on, tests call `npm run build` themselves via `beforeAll`, so `npm run test` alone is sufficient going forward. Astro inlines small stylesheets into a `<style>` tag during build rather than emitting an external `<link>` — the test accepts either form.
- [ ] **Step 2: Run the test and confirm it fails**