Repository navigation
Stop linking released API pages to the unreleased /next tree - #5017
Conversation
The `/next` tree is a preview that a developer opens by its URL. Search, the sitemap and the robots meta already leave it out, but the version picker on every released page and the fallback of the API landing card still linked to it. The picker now lists `Next (unreleased)` only on `/next` pages, and the card opens a released tree or is left out. Co-Authored-By: Claude Fable 5.2 <[email protected]>
| if (CanonicalDocument(resolved) is not { } canonical) | ||
| return null; |
There was a problem hiding this comment.
Severity: P3 (Low)
If /next is the only tree that renders in a build, omitting its card also suppresses the entire /api hub. The preview pages still link to /api in their breadcrumbs, so those links now lead to a missing page. Keep the hub available without the card, or omit its links when there is no hub.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
There was a problem hiding this comment.
No change here. The hub goes missing only when every API in the build lost all of its released versions and main alone loaded. The build reports that state for each API, and the search export stops on it. A hub page with no cards gives the reader nothing to open, and a card for the preview is the link this PR removes. If a degraded build should still write an empty hub, that is a separate change to Generate, which skips the catalog page when it has no entries.
There was a problem hiding this comment.
One distinction: the search-export failure does not itself prevent the preview pages from being generated. Generate renders products and then skips the catalog only when there are no entries; GenerateProduct renders each resolved tree before returning its (possibly null) catalog entry (OpenApiGenerator.cs#L135-L140, OpenApiGenerator.cs#L368-L420). The separate search-export path reports the unresolved versions and stops the export (OpenApiGenerator.cs#L226-L248); that diagnostic does not address the /api link still emitted on non-catalog pages (ApiBreadcrumbs.cs#L14-L24). So the concern still applies to the generated /next pages in this degraded case. If an empty hub is intentionally out of scope, omitting that breadcrumb when there is no hub remains the alternative in the finding.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
There was a problem hiding this comment.
You are right about the export: it stops the search index and does not stop the /next pages from rendering. I withdraw that part of my reply. The dead APIs crumb is real in that build.
I still leave it out of this PR, for two reasons.
The state needs every API in the build to declare a numeric major and to lose all of them while main loads. An API with no numeric major keeps main as its default tree, so IsNext is false and it keeps its card. The assembled site has several such APIs, so its hub cannot go missing this way. That leaves an isolated build of one versioned API whose index resolves and whose released specs all fail to fetch, and that build already reports each missing version.
Neither fix is local. ApiBreadcrumbs.Build does not know whether a hub exists, and the render context's catalog entries are empty in contexts that do have a hub, such as PageContentsAsync, so that list cannot stand in for it. Writing an empty hub means that Generate and GenerateCatalog stop skipping on zero entries, which also changes what a build with no loadable spec writes.
The right shape is one fact, whether the build writes a hub, that the catalog step and the breadcrumb both read. That is a change of its own.
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/5017/ Sample changed pages: |
…view by @infra-vault-gh-plugin-prod) An API with `main` and one major lost its version in the breadcrumb, the browser title and the landing heading, because the picker list came back empty. The list now keeps the one released entry. The menus still need two entries to show. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…view by @infra-vault-gh-plugin-prod) The fallback took the first released document in the order of the version index. An index that lists `7` before `8` sent the card to `/v7` when `9` failed to load. The fallback now picks the newest release that loaded. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Released API pages no longer link to the unreleased
/nexttree. The tree stays reachable at/api/<key>/next/for anyone who opens that URL.Affects: API reference
Prompt summary: The API docs show
Next, themainbranch of each spec. The team wants it hidden from search, the sitemap and indexing, and still available as a preview for developers who open the/nextlink by hand.Why
Search, the sitemap and the robots meta already leave
/nextout, through #4972, #4979 and #4976. Two links still lead there. The version picker on every released page listsNext (unreleased), so readers and crawlers reach the preview in one click. The card on the API landing page opens/nextwhen the default version fails to load.What
Version picker
A released page lists only released versions. A
/nextpage still listsNext (unreleased)as the selected entry, so the page says where the reader is and offers a way back. An API withmainand one major, such as Logstash, shows no picker on its released pages, because one version is not a choice. The filter lives inApiVersionSwitcher.Build, which feeds both menus and the breadcrumb.API landing card
When the default version fails to load, the card opens the newest released version that did load. When only the unreleased tree loaded, the API has no card, and
/api/llms.txtreads the same entry. The/nextpages still render in that case.Documentation
docs/data/openapi/api-explorer.mddescribes/nextas a preview opened by its URL, and states the fallback of the card.Out of scope: The
.md,.jsonand.yamlfiles of the/nexttree stay and carry no robots signal. A non-HTML file needs anX-Robots-Tagresponse header, which the CDN sets and this repository does not.Verify
Open
/api/elasticsearch/and/api/elasticsearch/next/and compare the version picker.Check on the preview
v9 (latest)andv8, with noNext (unreleased)entry.v8selected.Next (unreleased)selected abovev9 (latest)andv8.Next (unreleased)andv9 (latest).🤖 Generated with Claude Code