noindex tooling, content/noindex/component/testing guidelines for agents

- IPAL_NOINDEX=1: whole-site noindex for staging (robots Disallow /, robots
  meta noindex,nofollow, X-Robots-Tag via buildSecurityHeaders).
- Markdown mirrors and llms files: X-Robots-Tag noindex; Markdown adds a
  Link rel=canonical to the HTML page.
- buildNoindexField refuses noindex on the homepage and archive pages.
- AGENT.md §0c: writing pages for Google and AI (structure, answer-first,
  facts, E-E-A-T, entity consistency, sameAs, aiSummary, meta) and a
  when-to-noindex table (legal pages stay indexed by default; drafts instead
  of noindexed pages; staging via env).
- AGENT.md §6.0: ten component rules (small, Button styled once, buttons as
  '+ Add Button' array, variants, panel clarity); audit warns on buttons
  styled inside sections.
- AGENT.md §8a + smoke.spec.template.ts: what to test in a client project;
  PROGRAMISTA §8.1a: how the plugin itself is tested.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-16 03:13:44 +02:00
co-authored by Claude Opus 5.5
parent 8e2dd28b83
commit f7466cf77f
13 changed files with 314 additions and 10 deletions
+23
View File
@@ -236,3 +236,26 @@ describe('buildUploadSecurityHeaders', () => {
expect(csp).not.toContain('script-src')
})
})
describe('site-wide noindex (IPAL_NOINDEX) and Markdown headers', () => {
test('staging blocks crawling everywhere', async () => {
const { vi } = await import('vitest')
vi.stubEnv('IPAL_NOINDEX', '1')
try {
expect(buildRobots({ baseUrl: 'https://staging.acme.pl' })).toEqual({ rules: { disallow: ['/'], userAgent: '*' } })
expect(buildSecurityHeaders().find((h) => h.key === 'X-Robots-Tag')?.value).toBe('noindex, nofollow')
const { buildMetadata } = await import('../src/modules/seo/buildMetadata.js')
expect(buildMetadata({ config, locale: 'pl', slugs: { pl: 'x' } }).robots).toEqual({ follow: false, index: false })
} finally {
vi.unstubAllEnvs()
}
expect(buildSecurityHeaders().some((h) => h.key === 'X-Robots-Tag')).toBe(false)
})
test('Markdown mirrors are noindex with a canonical link to the HTML page', async () => {
const { markdownResponse } = await import('../src/modules/content/createMarkdownRenderer.js')
const res = markdownResponse('# x', { canonical: 'https://acme.pl/pl/o-nas' })
expect(res.headers.get('x-robots-tag')).toBe('noindex')
expect(res.headers.get('link')).toBe('<https://acme.pl/pl/o-nas>; rel="canonical"')
})
})