Repository navigation
Give every API page a meta description built from spec facts - #5013
Merged
Merged
Conversation
…page a meta description A page whose spec and authored text say nothing now takes a one-sentence description built from facts the spec declares: the product name, the method and route, the group's operation titles, the auth scheme names or the server URLs. `ApiFallbackDescription.For` is the one place that decides, so the HTML pages and the Markdown front matter cannot disagree. Text from the spec or the authored page still wins. 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/5013/ |
…@infra-vault-gh-plugin-prod) A long route or URL could push a fallback past the limit, because `ApiSeoDescription.Truncate` looks for a space after the cutoff. `ApiFallbackDescription.For` now cuts at or before the limit, ellipsis included. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…none (per review by @infra-vault-gh-plugin-prod) A spec that allows only anonymous access produced "How to authenticate requests", while the page says it declares no schemes. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…TML comment (per review by @infra-vault-gh-plugin-prod) The HTML page drops the comment and uses the generated sentence. The Markdown front matter kept the comment as its description. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ption (per review by @infra-vault-gh-plugin-prod) Every landing in the existing test owned or inherited a description, so deleting the landing fallback left it green. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…view by @infra-vault-gh-plugin-prod) A character such as an emoji in a title or product name could straddle the 150-character cut and leave half a pair, which encodes as a replacement character. `Cap` backs up one unit in that case. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…review by @infra-vault-gh-plugin-prod) No document-level scheme does not mean no scheme: a spec can allow anonymous access overall and still declare an API key on single operations. The sentence now claims only the document level. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ents (per review by @infra-vault-gh-plugin-prod) A description that opened with an HTML comment and then had prose got the generated sentence in Markdown, while the HTML page used the prose. Both now drop comments before they pick the first line. Co-Authored-By: Claude Sonnet 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, group, operation, authentication and servers pages that have no description of their own now get a one-sentence meta description built from facts the spec declares. Text from the spec or an authored page still wins.
Affects: API reference
Prompt summary: Fill the missing meta descriptions on API group, authentication, servers and landing pages for the SEO work in docs-eng-team#949. Where neither the spec nor an authored page has text, use a template that names only facts the spec declares, so no page claims more than the spec does.
Why
The SEO crawl found API pages with no meta description. The layout omits the tag when the description is empty, so a search engine shows its own excerpt. #4762 filled the pages that have source text. The Servers pages, Authentication pages without a topic, and any group or operation with no text still have none.
Closes elastic/docs-eng-team#1180
What
One rule for the fallback
ApiFallbackDescription.Fortakes the page and returns the sentence. It runs only when the spec or authored text gives nothing. The HTML pages and the Markdown front matter both call it, so the two cannot disagree.The sentences
Reference documentation for the {product} API.{group} endpoints in the {product} API: {first four operation titles}.{title}: {METHOD} {route} in the {product} API.How to authenticate requests to the {product} API: {scheme names}., orThe {product} API declares no authentication for the API as a whole.when no document-level scheme existsServer URLs for the {product} API: {URLs}.Every sentence is cut at or before 150 characters, ellipsis included.
Shared helper
ApiTag.OverviewRowsreplaces three copies of the sameBuildTagChildrencall.Verify
Removing the fallback in
ApiViewModel.CreateGlobalLayoutModelmakes that test fail.Out of scope: Catalog, schema and topic pages still emit an empty description when they have no text. They are not in the issue title. To list pages that remain empty on a real build, run this against the output folder:
🤖 Generated with Claude Code