Skip to content

Give API landing and authentication pages a meta description - #4762

Merged
reakaleek merged 9 commits into
mainfrom
api-seo-group-landing-descriptions
Nov 20, 2026
Merged

reakaleek merged 9 commits into
mainfrom
api-seo-group-landing-descriptions

Conversation

@reakaleek

@reakaleek reakaleek commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

API landing pages that carry no description of their own, such as the v8 and /next Elasticsearch 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.description leaves the landing empty even when the canonical spec (the default version's, which renders at the versionless URL) has one.

What

Version landings

ApiRenderContext.LandingDescription returns the spec's info.description and 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

StructuralViewModel passes 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_AreOnlyPagesWithNoSourceSentence generates 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):

grep -L 'name="description"' $(find .artifacts/docs/html/docs/api -name index.html)

Verify

dotnet test --project tests/Elastic.ApiExplorer.Tests

The 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

reakaleek and others added 2 commits November 6, 2026 13:22
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]>
@reakaleek
reakaleek requested a review from a team as a code owner November 6, 2026 12:28
@reakaleek
reakaleek requested a review from theletterf November 6, 2026 12:28
reakaleek and others added 2 commits November 6, 2026 14:15
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]>
Base automatically changed from worktree-agent-a4350398aa50a73b0 to main November 10, 2026 10:56
@github-actions

Copy link
Copy Markdown
Contributor

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]>
@reakaleek
reakaleek enabled auto-merge (squash) November 20, 2026 10:02
@reakaleek
reakaleek merged commit 3dc5be2 into main Nov 20, 2026
44 checks passed
@reakaleek
reakaleek deleted the api-seo-group-landing-descriptions branch November 20, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants