Derive page titles from product metadata - #4083
theletterf wants to merge 3 commits into
Conversation
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4083/ Sample changed pages: |
There was a problem hiding this comment.
Requesting changes: page title fallback was updated, but Pagefind title metadata still uses the raw H1 and can produce inconsistent search result titles.
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
d31bhlox0wglh.cloudfront.net
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "d31bhlox0wglh.cloudfront.net"See Network Configuration for more information.
What is this? | From workflow: PR Review
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
There was a problem hiding this comment.
Approved.
What is this? | From workflow: PR Review
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
Mpdreamz
left a comment
There was a problem hiding this comment.
Thanks for the product-aware title fallback work. I think this needs changes before merge:
-
P1
IndexViewModel.PageTitlechecks onlyCurrentDocument.YamlFrontMatter?.Productswhen choosing the qualifier. Page rendering already computes inferred products inHtmlWriterthroughDocumentInferrerService.InferForMarkdown(...)and passesProducts = pageProducts, so pages with one inferred product from docset config, repo,applies_to, ormapped_pagesbut no explicit frontmatterproductswill not get the product-aware title. This should reuse the page inference result instead of frontmatter-only products. -
P2
PagefindMarkdownExporterstill setsMeta["title"]tofile.Title ?? url. Because the exporter creates Pagefind records directly, isolated static search can keep showing the unqualified title even though the rendered HTML meta tag changed.
I did not spot other issues in the title/API path.
|
Addressed both findings in
The stacked #4079 also routes |
7ff0f69 to
42e8fc4
Compare
Use a single declared product as the SEO qualifier while keeping the H1 as the visible title and the manual override available as a final fallback. Co-Authored-By: GPT-5.6 Sol <noreply@anthropic.com>
Keep search result metadata consistent with the browser and Open Graph titles when product context is added automatically. Co-Authored-By: GPT-5.6 Sol <noreply@anthropic.com>
Resolve titles once from merged product metadata so rendered pages and direct Pagefind records cannot diverge. Co-Authored-By: GPT-5.6 Sol <noreply@anthropic.com>
42e8fc4 to
52459c8
Compare
|
Please hold off on merging until I can fully test and verify this works as expected. |
Pages keep their H1 as the visible heading while the HTML title automatically gains a product qualifier when inference resolves one product. API operation titles use the same fallback with an
APIqualifier.Affects: Authoring, API reference
Prompt summary: Derive the page title from the H1 and append the product name from frontmatter automatically. Cover Pattern B and API operation pages without a manual title, while retaining the explicit override as a final fallback in the stacked PR. Reuse the merged product inference result and keep direct Pagefind records consistent with rendered metadata.
Why
Pages with concise H1 headings can omit the product context that search results need. Authors should not have to repeat deterministic product metadata in a separate title field, and API operation pages already have a configured product available during rendering.
What
Product-aware fallback
A Markdown page that resolves to exactly one product appends that product's display name when the H1 does not already contain it. Resolution merges page frontmatter with docset, repository,
applies_to, andmapped_pagesmetadata. Pages with no product or multiple products keep the H1 unchanged because the builder cannot choose a single qualifier safely.Search metadata
Browser, Open Graph, and HTML Pagefind metadata use the shared title resolver. The direct Pagefind exporter performs the same product inference for isolated static search records, so it cannot fall back to the unqualified H1.
API operation titles
API operation pages append the configured product name and the
APIkeyword to their H1-derived title. Their visible heading and breadcrumb remain unchanged.Public title suffix
Public assembler pages use the unified
| Elastic Docssuffix. Isolated and custom-branded builds retain their existing site-specific suffixes.Authoring guidance
The title syntax guide documents the automatic fallback, its inferred single-product boundary, and the API operation variant.
Verify
Stack: 1 of 2. #4079 will stack on this PR.
Part of #3938.