Pass siteDescription to page metadata; document media cache rule
createPageMetadata read Site Settings → siteDescription but never passed it to buildMetadata, so pages without their own meta description had no <meta name="description"> or og:description. Regression test in seo.test.ts. storage.md: Cloudflare Cache Rule for the media domain (R2 objects carry no Cache-Control; storage-s3 cannot set it, Cloudflare defaults to 4 h). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d28cbe2570
commit
a6eda2e3a3
@@ -9,6 +9,7 @@ import { buildCsp } from '../src/modules/security/buildCsp.js'
|
||||
import { buildSecurityHeaders } from '../src/modules/security/buildSecurityHeaders.js'
|
||||
import { AI_TRAINING_BOTS, buildRobots } from '../src/modules/seo/buildRobots.js'
|
||||
import { buildSitemapXml } from '../src/modules/seo/buildSitemapXml.js'
|
||||
import { createPageMetadata } from '../src/modules/seo/createPageMetadata.js'
|
||||
import { buildHreflangAlternates } from '../src/modules/seo/hreflang.js'
|
||||
|
||||
const config: I18nConfig = {
|
||||
@@ -259,3 +260,31 @@ describe('site-wide noindex (IPAL_NOINDEX) and Markdown headers', () => {
|
||||
expect(res.headers.get('link')).toBe('<https://acme.pl/pl/o-nas>; rel="canonical"')
|
||||
})
|
||||
})
|
||||
|
||||
describe('createPageMetadata — siteDescription fallback', () => {
|
||||
// Regresja 1.10.0: readSiteMetaConfig czytał siteDescription, ale nie trafiał do buildMetadata —
|
||||
// strona bez meta.description nie miała <meta name="description"> (Lighthouse SEO).
|
||||
const settings = { homepage: null, siteDescription: 'Opis firmy z Site Settings', siteName: 'Acme' }
|
||||
const payload = {} as never
|
||||
|
||||
test('page without its own description gets Site Settings → siteDescription', async () => {
|
||||
const pageMetadata = createPageMetadata({
|
||||
baseUrl: 'https://acme.pl',
|
||||
config,
|
||||
loaders: { getSettings: async () => settings, resolveRoute: async () => null },
|
||||
})
|
||||
const metadata = await pageMetadata({ slug: ['o-nas'], locale: 'pl', payload })
|
||||
expect(metadata.description).toBe('Opis firmy z Site Settings')
|
||||
expect(metadata.openGraph?.description).toBe('Opis firmy z Site Settings')
|
||||
})
|
||||
|
||||
test('no siteDescription → no description (field omitted, not invented)', async () => {
|
||||
const pageMetadata = createPageMetadata({
|
||||
baseUrl: 'https://acme.pl',
|
||||
config,
|
||||
loaders: { getSettings: async () => ({ ...settings, siteDescription: null }), resolveRoute: async () => null },
|
||||
})
|
||||
const metadata = await pageMetadata({ slug: ['o-nas'], locale: 'pl', payload })
|
||||
expect(metadata.description).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user