Repository navigation
Give API landing and authentication pages a meta description - #4762
Merged
Merged
Conversation
An operation description opens with a bold sentence and the method and path lines. Strip that block by structure, then fall back to the operation summary, so the meta description and the Markdown front matter use the operation's own text. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ource sentence exists A v8 or v9 landing with no description of its own now takes the one the API's canonical spec carries. An authentication page written as a topic uses its opening sentence. Group and operation pages already follow their tag text and summary, and servers pages stay empty because no source sentence exists. A test generates a sample and lists every page whose meta description is empty. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
A description with a colon or quote, such as an authentication sentence, made the front matter invalid YAML. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The multi-version test only read the HTML meta tag, so a regression in the Markdown front matter description would pass. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4762/ |
akira28
approved these changes
Nov 18, 2026
Main now serves the newest major at the versionless URL and moves main to /next, so the canonical spec the landing fallback borrows from is the default version's. The meta description test now puts the description on that spec and expects the /api/<key> paths without /doc. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The HTML meta tag excerpts the landing description, which skips a leading heading and caps the length, while the Markdown front matter kept its raw first line. Per review by the Libra bot. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
API landing pages that carry no description of their own, such as the v8 and
/nextElasticsearch landings, now take the canonical spec's description, and an Authentication page written as a topic uses its opening sentence as its meta description.Affects: API reference
Prompt summary: Give the API pages that have no meta description one, using only text that already exists in the spec or the authored pages. Group pages use their opening sentence, authentication and servers pages only when a source sentence exists, and the pages that stay empty are listed for the content team. No invented copy.
Why
The SEO crawl found 189 API pages with no meta description. The layout omits the tag when the description is empty, so those pages show a search engine's own excerpt. A versioned Elasticsearch landing renders from its own spec, and a spec without
info.descriptionleaves the landing empty even when the canonical spec (the default version's, which renders at the versionless URL) has one.What
Version landings
ApiRenderContext.LandingDescriptionreturns the spec'sinfo.descriptionand falls back to the description of the API's catalog entry, which comes from the canonical spec. The HTML meta tag and the Markdown front matter both read it, so the two stay in step.Authentication pages
StructuralViewModelpasses the topic text of an Authentication page to the layout as its description. The Markdown front matter does the same for structural pages. Servers pages and Authentication pages with no topic stay empty, because no source sentence exists.Group and operation pages
These needed no new rule. Group pages already excerpt the tag description, skipping a leading heading, and operation pages fall back to the summary after #4761. The group front matter now uses
ApiSeoDescription.Excerpt, so it matches the HTML instead of keeping a raw first line such as## Overview.The empty-description check
Generate_EmptyMetaDescriptions_AreOnlyPagesWithNoSourceSentencegenerates a main (/next), v9 (versionless and/v9) and v8 sample, with the description only on v9, and lists every page with no meta description. The list is asserted literally, so a page that gains or loses a description fails the test.Out of scope: The 110 group pages and 62 operation pages from the crawl could not be counted here. The real Elasticsearch and Kibana specs are overlaid at build time and the raw specs in the public repositories carry no tags, so no local build reproduces the crawl. The pages that stay empty are those whose tag has no description and whose operation has no summary or description. To list them for the content team after a real build, run this against the output folder (adjust the path to where the build writes its HTML):
Verify
dotnet test --project tests/Elastic.ApiExplorer.TestsThe one failure in this sandbox,
OpenApiDocumentExporterTests, needs network access and does not touch this change. Reverting the landing fallback makes the new test fail.🤖 Generated with Claude Code
Closes elastic/docs-eng-team#1179