Skip to content

Drop the trailing slash from API children: page URLs - #4992

Merged
reakaleek merged 1 commit into
mainfrom
fix-spaces-trailing-slash-d44bb344
Nov 20, 2026
Merged

reakaleek merged 1 commit into
mainfrom
fix-spaces-trailing-slash-d44bb344

Conversation

@reakaleek

Copy link
Copy Markdown
Member

API pages listed under children: now get URLs without a trailing slash. The sitemap stops listing /docs/api/kibana/spaces/ and /docs/api/kibana/v8/spaces/, which docs-edge redirects to the bare path.

Affects: API reference, Search

Prompt summary: kibana/spaces/ and kibana/v8/spaces/ are the only URLs on the site with a trailing slash. docs-edge redirects them to the bare path, so the sitemap lists a URL that redirects. The ask is to make the sitemap list the URL that serves the page.

Why

ApiUrlBuilder.ChildUrl builds the URL of every children: page in an API docset, and it ends that URL in /. The other API URL builders do not. Kibana's spaces page is the only children: page in production. The sidebar link, the search index entry and sitemap-api.xml all take its URL from ChildUrl, and docs-edge answers that URL with a 301.

What

The URL of a children: page

The URL now ends at the page slug, the same as the authentication, servers and topic pages. The built files stay the same, because the output path already strips a trailing slash before it adds /index.html. Canonical URLs, breadcrumbs and the version switcher already compare URLs without the slash, so they do not change.

Tests

A new test pins ChildUrl without a trailing slash, for a versionless and a versioned API. Four existing tests expected the slash and now expect the bare URL. With the slash put back, six tests fail.

Out of scope: the docs-infra redirects from Bump.sh topics to child pages still point at the URL with the slash. They keep working through the edge 301.

Risk: the search index keys a document by its URL. The next incremental index writes the page under the bare URL. The stale entry with the slash should drop out through the normal cleanup of stale documents. Check this on edge after the deploy.

Verify

dotnet test --project tests/Elastic.ApiExplorer.Tests
# ChildUrl_HasNoTrailingSlash, IntroNav_ShouldGenerateCorrectUrl, CreateNavigation_Children*

After the deploy, this prints nothing:

curl -s https://docs-edge.elastic.dev/docs/sitemap-api.xml | grep -o '<loc>[^<]*/</loc>'

🤖 Generated with Claude Code

`ApiUrlBuilder.ChildUrl` was the only API URL builder that ended in `/`. The sitemap listed `/docs/api/kibana/spaces/`, and docs-edge redirects that URL to the bare path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@reakaleek
reakaleek requested a review from a team as a code owner November 20, 2026 14:23
@reakaleek reakaleek added the bug label Nov 20, 2026
@reakaleek
reakaleek requested a review from akira28 November 20, 2026 14:23
/// <summary>URL of a <c>children:</c> page, from its file slug.</summary>
public static string ChildUrl(string? urlPathPrefix, string apiUrlSuffix, string slug) =>
$"{ProductRoot(urlPathPrefix, apiUrlSuffix)}/{slug}/";
$"{ProductRoot(urlPathPrefix, apiUrlSuffix)}/{slug}";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: P3 (Low)

Carry forward the existing content date when switching to the slashless URL. The index looks up content_last_updated by exact URL, so the first reindex stamps unchanged Spaces pages with the deploy date. The sitemap then publishes that date as <lastmod>, and subsequent syncs keep it even though the page content did not change.

Generated by Libra. React with 👍 or 👎 to give feedback on this comment.

@reakaleek
reakaleek enabled auto-merge (squash) November 20, 2026 14:27
@github-actions

Copy link
Copy Markdown
Contributor

@reakaleek
reakaleek merged commit d456cf6 into main Nov 20, 2026
50 checks passed
@reakaleek
reakaleek deleted the fix-spaces-trailing-slash-d44bb344 branch November 20, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants