Skip to content

fix(page-card): apply UrlPathPrefix to resolved URLs#3490

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

fix(page-card): apply UrlPathPrefix to resolved URLs#3490
theletterf merged 9 commits into
mainfrom
fix/cli-namespace-page-card-urls

Conversation

@theletterf

Copy link
Copy Markdown
Member

Summary

  • PageCardBlock.FinalizeAndValidate() was computing site-root-relative URLs (e.g. /cli/stack/es) without applying the UrlPathPrefix, causing all page-card links to 404 in preview environments hosted under a subpath (e.g. /elastic/cli/pull/406/).
  • Nav links, breadcrumbs, and Previous/Next pagination were unaffected because they use INavigationItem.Url which has the prefix applied at a different layer.
  • The fix applies the same UrlPathPrefix logic already used by DiagnosticLinkInlineParser (lines 361–363).

Test plan

  • Verify page-card links in preview resolve to /elastic/cli/pull/<N>/cli/stack/es instead of /cli/stack/es
  • Verify page-card links on production docs (no prefix) still work — UrlPathPrefix is empty so the guard condition short-circuits

🤖 Generated with Claude Code

theletterf and others added 9 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>
Prevents padded whitespace in non-empty overrides from leaking into
nav/file metadata.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Page-card links were generating site-root-relative hrefs (e.g. /cli/stack/es)
without the deployment path prefix, causing 404s in preview environments where
the site is hosted under a subpath (e.g. /elastic/cli/pull/406/cli/stack/es).

Apply the same UrlPathPrefix logic used by DiagnosticLinkInlineParser.

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

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f58f7afa-8716-441a-a106-708451e0c3d0

📥 Commits

Reviewing files that changed from the base of the PR and between d11e18d and 1945fcf.

📒 Files selected for processing (3)
  • src/Elastic.Markdown/Extensions/CliReference/CliMarkdownGenerator.cs
  • src/Elastic.Markdown/Extensions/CliReference/CliRootFile.cs
  • src/Elastic.Markdown/Myst/Directives/PageCard/PageCardBlock.cs

📝 Walkthrough

Walkthrough

This PR makes three focused changes to URL handling and input normalization across CLI reference generation and page card components. The CLI markdown generator removes /index.md suffixes from all namespace-related links (root pages, namespace aliases, and sub-namespace cards), treating them as directory references. The CLI root file now trims title inputs and normalizes whitespace-only values to sensible defaults. Finally, page card blocks gain support for URL path prefixes, respecting build context settings for correct sub-path deployments.

Possibly related PRs

  • elastic/docs-builder#3361: Both PRs modify the same namespace and alias link generation logic in CliMarkdownGenerator.NamespacePage—the current PR simplifies URL formats by removing /index.md suffixes while the retrieved PR extends namespace page functionality for alias content.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change—applying UrlPathPrefix to resolved URLs in PageCardBlock—which directly addresses the core issue described in the PR.
Description check ✅ Passed The description clearly explains the problem (page-card links missing UrlPathPrefix in preview environments), the impact, and the solution approach, with a concrete test plan.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/cli-namespace-page-card-urls

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@theletterf theletterf enabled auto-merge (squash) June 11, 2026 13:21
@theletterf theletterf merged commit b75b08b into main Jun 11, 2026
25 of 26 checks passed
@theletterf theletterf deleted the fix/cli-namespace-page-card-urls branch June 11, 2026 13:26
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