feat: noindex for declared and signed-in routes

- app plugin seo-route-robots: a page whose meta sets requiresAuth: true
  gets robots noindex, nofollow, a page with seo.robots gets its value,
  a path under seo.noindexRoutes gets noindex, nofollow; meta tag above
  the CMS head entry and X-Robots-Tag during SSR, never on staging
- requiresAuth and seo added to Nuxt's page meta extraction keys
- playground /konto, /szkic and /prywatne with their smoke lines
This commit is contained in:
Jakub Zych
2026-11-04 11:49:14 +01:00
parent b4680af0e3
commit 9cc2cda924
9 changed files with 143 additions and 1 deletions

19
tests/routes.test.ts Normal file
View File

@@ -0,0 +1,19 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import { pageMetaRobots, robotsNoindex } from '../lib/routes.ts'
test('pageMetaRobots: seo.robots, then requiresAuth, else the CMS decides', () => {
assert.equal(pageMetaRobots({ requiresAuth: true }), 'noindex, nofollow')
assert.equal(pageMetaRobots({ requiresAuth: true, seo: { robots: 'noindex, follow' } }), 'noindex, follow')
assert.equal(pageMetaRobots({ seo: { robots: ' index, follow ' } }), 'index, follow')
assert.equal(pageMetaRobots({ requiresAuth: false }), null)
assert.equal(pageMetaRobots({ seo: { breadcrumbs: false } }), null)
assert.equal(pageMetaRobots(undefined), null)
})
test('robotsNoindex: noindex and none keep a page out', () => {
assert.equal(robotsNoindex('noindex, follow'), true)
assert.equal(robotsNoindex('none'), true)
assert.equal(robotsNoindex('index, follow'), false)
assert.equal(robotsNoindex(null), false)
})