Skip to content

fix(cli-reference): use segment path instead of segment/index.md for namespace page cards#3489

Merged
theletterf merged 8 commits into
mainfrom
fix/cli-namespace-page-card-urls
Jun 11, 2026
Merged

fix(cli-reference): use segment path instead of segment/index.md for namespace page cards#3489
theletterf merged 8 commits into
mainfrom
fix/cli-namespace-page-card-urls

Conversation

@theletterf

Copy link
Copy Markdown
Member

Summary

  • Namespace and sub-namespace page card links were generated as ./segment/index.md
  • The docs-builder resolved these to /cli/.../segment/index (404) instead of /cli/.../segment
  • Fix: drop the /index.md suffix — use the bare segment path so the link resolves to the correct namespace URL

Affected call sites in CliMarkdownGenerator.cs:

  • RootPage: top-level namespace cards
  • NamespacePage: sub-namespace cards and alias blurb links

Test plan

  • Build the CLI reference locally and verify namespace page cards link to the correct URLs
  • Confirm sub-namespace links on e.g. /cli/stack go to /cli/stack/es, not /cli/stack/es/index

🤖 Generated with Claude Code

theletterf and others added 6 commits June 10, 2026 09:14
Allow cli TOC entries to override the generated root page title and navigation label without changing schema command names.

Co-authored-by: GPT-5.5 <gpt-5.5@openai.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve the CLI reference generator overlap by preserving supplemental frontmatter output and keeping the root title override for the generated H1.

Co-authored-by: GPT-5.5 <gpt-5.5@openai.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: GPT-5.5 <gpt-5.5@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…namespace page cards

Namespace and sub-namespace page card links were generated as
./segment/index.md, which the docs-builder resolved to /cli/.../segment/index
(a 404) instead of /cli/.../segment.

Drop the /index.md suffix so links resolve to the correct namespace URL.
Affects RootPage (top-level namespaces), NamespacePage (sub-namespaces and
alias blurb links).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@theletterf theletterf requested review from a team as code owners June 11, 2026 11:47
@theletterf theletterf requested a review from cotti June 11, 2026 11:47
@theletterf theletterf temporarily deployed to integration-tests June 11, 2026 11:47 — with GitHub Actions Inactive
@theletterf theletterf self-assigned this Jun 11, 2026
@theletterf theletterf added the fix label Jun 11, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Elastic.Markdown/Extensions/CliReference/CliRootFile.cs`:
- Around line 33-35: Trim the provided override strings before assigning them to
the backing fields so leading/trailing whitespace isn't preserved: when
computing _title and _navigationTitle (in the CliRootFile
constructor/initializer where _title = ... and _navigationTitle = ... are set)
call Trim() (or TrimInvariant) on the inputs (title and navigationTitle) before
checking IsNullOrWhiteSpace and before assigning to Title/_navigationTitle so
stored Title and NavigationTitle are the trimmed values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d869eb17-27dc-4275-b419-48e1654f8760

📥 Commits

Reviewing files that changed from the base of the PR and between 9c4e40f and 7566ded.

📒 Files selected for processing (9)
  • docs/cli/cli-reference-how-to.md
  • src/Elastic.Documentation.Configuration/Toc/CliReference/CliReferenceRef.cs
  • src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs
  • src/Elastic.Documentation.Configuration/Toc/TableOfContentsYamlConverters.cs
  • src/Elastic.Markdown/Extensions/CliReference/CliMarkdownGenerator.cs
  • src/Elastic.Markdown/Extensions/CliReference/CliReferenceDocsBuilderExtension.cs
  • src/Elastic.Markdown/Extensions/CliReference/CliRootFile.cs
  • tests/Elastic.Documentation.Configuration.Tests/PhysicalDocsetTests.cs
  • tests/Elastic.Markdown.Tests/CliReference/CliMarkdownGeneratorTests.cs

Comment thread src/Elastic.Markdown/Extensions/CliReference/CliRootFile.cs Outdated
theletterf and others added 2 commits June 11, 2026 13:59
Prevents padded whitespace in non-empty overrides from leaking into
nav/file metadata.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@theletterf theletterf temporarily deployed to integration-tests June 11, 2026 12:00 — with GitHub Actions Inactive
@theletterf theletterf requested review from Mpdreamz and removed request for cotti June 11, 2026 12:01
@elastic elastic deleted a comment from coderabbitai Bot Jun 11, 2026
@theletterf theletterf merged commit d11e18d into main Jun 11, 2026
25 checks passed
@theletterf theletterf deleted the fix/cli-namespace-page-card-urls branch June 11, 2026 12:40
theletterf added a commit to theletterf/cli that referenced this pull request Jun 11, 2026
Now that the docs-builder correctly resolves namespace page card URLs
(elastic/docs-builder#3489), the supplemental content files can go back
to their original subdirectory form (stack/es/index.md). The flat-file
approach broke command links on the es/kb pages by displacing the
schema-generated page structure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

3 participants