feat: CMS head and one JSON-LD graph on every server-rendered page (tracer)
- Nitro middleware resolves page requests once and hands the answer to the render (event.context.seo); the route middleware reuses it - useCmsSeo: html lang, hreflang links, og:locale and exactly one JSON-LD script with one @graph (CMS nodes plus useSchemaNode nodes, merged by @id) - local module (configKey seo): cms (alias of public.seo.enabled), breadcrumbs, links.newTabHint, rootFiles, resolveFiles - GET /api/__seo__/resolve for client navigation through the Nuxt server - smoke harness: count=, exact header=, noheader=, reqheader=, repeated options, resolves/apicalls/noreport lines, --no-site; v0.1.1 suite runs unchanged against a backend without /site
This commit is contained in:
@@ -17,7 +17,16 @@ export interface SeoHead {
|
||||
canonical: string
|
||||
robots: string
|
||||
x_robots_tag: string
|
||||
og: { title: string; description: string; image: string; url: string }
|
||||
og: {
|
||||
title: string
|
||||
description: string
|
||||
image: string
|
||||
url: string
|
||||
/** og:locale of the page (pl_PL); absent from backends before SEO v0.2.0. */
|
||||
locale?: string
|
||||
/** og:locale:alternate values, one per other translated locale. */
|
||||
locale_alternates?: string[]
|
||||
}
|
||||
twitter: { card: string; site: string }
|
||||
verification: SeoMetaTag[]
|
||||
}
|
||||
@@ -35,4 +44,68 @@ export interface SeoResolveAnswer {
|
||||
staging: boolean
|
||||
/** Set on ok answers only. */
|
||||
seo: SeoHead | null
|
||||
// The keys below are additive (SEO plugin v0.2.0); an older backend leaves
|
||||
// them out and every consumer treats an absent key as empty.
|
||||
/** The <html lang> value (pl, pl-PL), set on ok answers. */
|
||||
html_lang?: string
|
||||
/** hreflang alternates including the page itself and x-default; absolute URLs. */
|
||||
alternates?: SeoAlternate[]
|
||||
/** One {"@context", "@graph"} object, or null. */
|
||||
jsonld?: SeoJsonLd | null
|
||||
breadcrumbs?: SeoBreadcrumb[]
|
||||
/** Present only when the request carries a page number. */
|
||||
pagination?: SeoPaginationAnswer
|
||||
outbound?: SeoOutbound
|
||||
autolinks?: Array<{ phrase: string; url: string }>
|
||||
autolink_max?: number
|
||||
}
|
||||
|
||||
export interface SeoAlternate {
|
||||
hreflang: string
|
||||
url: string
|
||||
}
|
||||
|
||||
/** A schema.org node; @id links nodes across the graph. */
|
||||
export type SeoSchemaNode = Record<string, unknown> & { '@id'?: string; '@type'?: string | string[] }
|
||||
|
||||
export interface SeoJsonLd {
|
||||
'@context'?: string
|
||||
'@graph'?: SeoSchemaNode[]
|
||||
}
|
||||
|
||||
export interface SeoBreadcrumb {
|
||||
name: string
|
||||
url: string
|
||||
path: string
|
||||
}
|
||||
|
||||
export interface SeoPaginationAnswer {
|
||||
form?: 'query' | 'path'
|
||||
param?: string
|
||||
segment?: string
|
||||
page?: number
|
||||
/** A page value that is not a page number (?page=abc): the layer answers 404. */
|
||||
invalid?: boolean
|
||||
}
|
||||
|
||||
export interface SeoOutbound {
|
||||
new_tab?: boolean
|
||||
nofollow_domains?: string[]
|
||||
sponsored_domains?: string[]
|
||||
}
|
||||
|
||||
/** GET /_seo/api/v1/site. Every key may be absent on an older backend. */
|
||||
export interface SeoSiteAnswer {
|
||||
site_url?: string
|
||||
default_locale?: string
|
||||
locales?: string[]
|
||||
unprefixed_locale?: string
|
||||
links?: { new_tab?: boolean }
|
||||
html_sitemap?: { enabled?: boolean; paths?: Record<string, string>; page_size?: number }
|
||||
routes?: Array<{ type: string; pattern: string }>
|
||||
/** Root file names the backend serves (verification files, the IndexNow key file). */
|
||||
root_files?: string[]
|
||||
llms?: boolean
|
||||
pagination?: { form?: 'query' | 'path'; param?: string; segments?: Record<string, string> }
|
||||
home_crumb?: { name?: string; url?: string } | null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user