Skip to content

Continue white-label branding support for isolated builds#3259

Merged
Mpdreamz merged 3 commits intomainfrom
feature/whitelabel-continued
May 7, 2026
Merged

Continue white-label branding support for isolated builds#3259
Mpdreamz merged 3 commits intomainfrom
feature/whitelabel-continued

Conversation

@Mpdreamz
Copy link
Copy Markdown
Member

@Mpdreamz Mpdreamz commented May 6, 2026

Summary

Continuation of #3159. Fixes remaining Elastic-specific content leaking into branded builds.

Navigation search gated on branding

  • <navigation-search> (requires Elastic AI backend) now hidden for branded builds alongside Codex; added Branding property to NavigationViewModel

Favicon auto-discovery

  • When branding: is set, docs-builder looks for favicon.ico/png/svg and apple-touch-icon.png in the docs source directory automatically — no YAML config needed
  • Optional explicit overrides via branding.favicon / branding.apple-touch-icon
  • _Favicon.cshtml converted to typed RazorSlice<GlobalLayoutViewModel> to render custom or Elastic defaults conditionally

llms.txt branding

  • Elastic boilerplate preamble suppressed for branded builds; LlmMarkdownExporter takes a branded flag, passed through ExporterExtensions and ReloadableGeneratorState

Header fixes (observed on cli-schema.pages.dev)

  • Logo <img> size increased from 24 px → 32 px
  • Branded home link no longer uses HTMX (containerRef detached from branded logo spans)
  • Default header background falls back to the same gradient as non-branded builds when no header-bg is configured (was black)

Edit this page / GitHub link fix

  • GitHubRepository now returns null instead of the hardcoded "elastic/docs-builder" when the remote URL can't be resolved
  • Both editUrl and gitHubDocsUrl guards updated to is not null checks — links are hidden rather than pointing to the wrong repo
  • CI path unaffected: GITHUB_REPOSITORY env var fallback still resolves cli-schema/cli-schema correctly

Test plan

  • Build cli-schema branded docs and confirm: no <navigation-search>, custom favicon in tab, gradient header background, no Elastic boilerplate in llms.txt
  • Confirm edit link hidden locally (no GITHUB_REPOSITORY env var) and correct on CI
  • Non-branded builds unchanged: Elastic favicon, search widget visible, llms.txt boilerplate present
  • ./build.sh unit-test passes

🤖 Generated with Claude Code

- Gate <navigation-search> on branding (requires Elastic backend)
- Auto-discover favicon/apple-touch-icon from docs source dir when branding is set; explicit overrides via branding.favicon / branding.apple-touch-icon
- Suppress Elastic boilerplate in llms.txt for branded builds
- Header: fix logo size (32px), prevent HTMX on home link, default to gradient bg when no header-bg is configured
- Fix GitHubRepository returning hardcoded elastic/docs-builder on fallback; now returns null so edit/GitHub links are hidden rather than wrong; GITHUB_REPOSITORY env var fallback still works on CI

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@Mpdreamz Mpdreamz requested a review from a team as a code owner May 6, 2026 20:04
@Mpdreamz Mpdreamz added the whitelabel continuation White-label branding continuation work label May 6, 2026
@Mpdreamz Mpdreamz requested a review from cotti May 6, 2026 20:04
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Warning

Rate limit exceeded

@Mpdreamz has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 24 minutes and 45 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: da204aa0-597f-407a-a28a-922f4425b67a

📥 Commits

Reviewing files that changed from the base of the PR and between 9ecd1df and 010eee8.

📒 Files selected for processing (5)
  • src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs
  • src/Elastic.Documentation.Site/Layout/_Favicon.cshtml
  • src/Elastic.Documentation/GitCheckoutInformation.cs
  • src/services/Elastic.Documentation.Isolated/IsolatedBuildService.cs
  • src/tooling/docs-builder/Http/ReloadableGeneratorState.cs
📝 Walkthrough

Walkthrough

The pull request extends branding configuration to auto-discover favicon and Apple Touch icon files when not explicitly provided, and propagates branding information through the rendering pipeline. Changes include: adding Favicon and AppleTouchIcon properties to BrandingConfiguration with auto-discovery via DiscoverBrandingFile; updating Header and favicon view templates to conditionally render branding assets; passing branding context through ViewModels (NavigationViewModel, GlobalLayoutViewModel); and updating markdown exporters to accept a branded flag controlling content generation. GitHubRepository is changed to nullable, and null-checks are added where applicable.

Sequence Diagram

sequenceDiagram
    participant Builder as Configuration Builder
    participant Context as Build Context
    participant NavVM as Navigation ViewModel
    participant LayoutVM as Layout ViewModel
    participant Header as Header Template
    participant Favicon as Favicon Template
    
    Builder->>Builder: Validate branding config
    Builder->>Builder: Auto-discover favicon/apple-touch-icon<br/>(DiscoverBrandingFile)
    Builder->>Context: Set Configuration.Branding
    
    Context->>NavVM: Create with Branding property
    Context->>LayoutVM: Create with Branding properties<br/>(Favicon/AppleTouchIcon static paths)
    
    NavVM->>Header: Provide Branding context
    Header->>Header: Conditionally compute<br/>header CSS based on branding
    Header->>Header: Render branded or default logo
    
    LayoutVM->>Favicon: Provide branding favicon paths
    Favicon->>Favicon: Check if Branding exists
    alt Branding present
        Favicon->>Favicon: Compute MIME type from extension
        Favicon->>Favicon: Render branded favicon/apple-touch-icon
    else No branding
        Favicon->>Favicon: Render default favicon
    end
Loading
🚥 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 summarizes the main change: continuation of white-label branding support for isolated builds, which aligns with the PR's comprehensive branding improvements.
Description check ✅ Passed The description provides relevant, detailed context covering the key changes: navigation search gating, favicon auto-discovery, llms.txt branding, header fixes, and GitHub link corrections.
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 feature/whitelabel-continued

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

coderabbitai[bot]
coderabbitai Bot previously requested changes May 6, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 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.Documentation.Configuration/Builder/ConfigurationFile.cs`:
- Around line 306-309: ValidateBrandingImage currently returns null on
validation failure and the code uses the null-coalescing operator to call
DiscoverBrandingFile, causing a broken explicit path to be overwritten; change
the logic for branding.Favicon and branding.AppleTouchIcon so
DiscoverBrandingFile is only invoked when no explicit override was provided
(original value null/empty) — e.g., capture the original value, if
string.IsNullOrEmpty(original) then set from DiscoverBrandingFile, otherwise set
to the result of ValidateBrandingImage and do not fall back on discovery when
validation fails; mirror this behavior with the other fields (Icon, OgImage) for
consistency.

In `@src/Elastic.Documentation.Site/Layout/_Favicon.cshtml`:
- Around line 13-18: The current switch that sets mimeType (based on
System.IO.Path.GetExtension(fav)) uses a catch-all that maps ".jpg" to the
non-standard "image/jpg"; update the switch on mimeType to enumerate common
image extensions explicitly—keep ".ico" => null and ".svg" => "image/svg+xml",
add ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".png" => "image/png" (and
any other expected extensions you need), and only use a generic fallback if you
explicitly want one; modify the switch expression around the mimeType variable
so these explicit cases replace the var e => ... arm.

In `@src/Elastic.Documentation/GitCheckoutInformation.cs`:
- Line 49: GitHubRepository currently calls ExtractGitHubOrgRepo(Remote) but
Remote can be the placeholder string "elastic/docs-builder-unknown" which parses
as a valid org/repo; update the logic so that GitHubRepository returns null when
Remote equals the placeholder (or modify ExtractGitHubOrgRepo to detect and
return null for that sentinel) so downstream consumers don't get a fake repo;
reference the GitHubRepository property and the ExtractGitHubOrgRepo helper and
ensure any fallback value is treated as "no repo" (null) rather than a parsable
repo.

In `@src/tooling/docs-builder/Http/ReloadableGeneratorState.cs`:
- Line 102: The call to AddLlmMarkdownExport passes a positional boolean; update
the call to use a named boolean argument (e.g., branded:
_context.Configuration.Branding is not null) so the intent is explicit — locate
the call to markdownExporters.AddLlmMarkdownExport(...) in
ReloadableGeneratorState (the AddLlmMarkdownExport method call) and change the
argument to a named parameter referencing _context.Configuration.Branding is not
null.
🪄 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: 5fe717f7-7b0a-41fa-8c40-3202dd740d69

📥 Commits

Reviewing files that changed from the base of the PR and between c846692 and 9ecd1df.

📒 Files selected for processing (16)
  • src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs
  • src/Elastic.Documentation.Configuration/Toc/DocumentationSetFile.cs
  • src/Elastic.Documentation.Site/Assets/web-components/Header/Header.tsx
  • src/Elastic.Documentation.Site/Layout/_Favicon.cshtml
  • src/Elastic.Documentation.Site/Layout/_Head.cshtml
  • src/Elastic.Documentation.Site/Navigation/IsolatedBuildNavigationHtmlWriter.cs
  • src/Elastic.Documentation.Site/Navigation/NavigationViewModel.cs
  • src/Elastic.Documentation.Site/Navigation/_TocTree.cshtml
  • src/Elastic.Documentation.Site/_ViewModels.cs
  • src/Elastic.Documentation/GitCheckoutInformation.cs
  • src/Elastic.Markdown/DocumentationGenerator.cs
  • src/Elastic.Markdown/Exporters/ExporterExtensions.cs
  • src/Elastic.Markdown/Exporters/LlmMarkdownExporter.cs
  • src/Elastic.Markdown/HtmlWriter.cs
  • src/services/Elastic.Documentation.Isolated/IsolatedBuildService.cs
  • src/tooling/docs-builder/Http/ReloadableGeneratorState.cs

Comment thread src/Elastic.Documentation.Configuration/Builder/ConfigurationFile.cs Outdated
Comment thread src/Elastic.Documentation.Site/Layout/_Favicon.cshtml
Comment thread src/Elastic.Documentation/GitCheckoutInformation.cs Outdated
Comment thread src/tooling/docs-builder/Http/ReloadableGeneratorState.cs Outdated
@Mpdreamz Mpdreamz added fix and removed whitelabel continuation White-label branding continuation work labels May 7, 2026
- ConfigurationFile: only auto-discover favicon/apple-touch-icon when no
  explicit override was given; a failing explicit path no longer silently
  falls back to a discovered file
- _Favicon.cshtml: enumerate MIME types explicitly so .jpg maps to
  image/jpeg (was non-standard image/jpg); .gif and .webp added too
- GitCheckoutInformation: treat sentinel remote
  "elastic/docs-builder-unknown" as null in GitHubRepository so it
  doesn't parse as a valid org/repo path
- ReloadableGeneratorState: use named argument branded: for
  AddLlmMarkdownExport call

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@Mpdreamz
Copy link
Copy Markdown
Member Author

Mpdreamz commented May 7, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Mpdreamz
Copy link
Copy Markdown
Member Author

Mpdreamz commented May 7, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Mpdreamz Mpdreamz merged commit ffc36c6 into main May 7, 2026
24 checks passed
@Mpdreamz Mpdreamz deleted the feature/whitelabel-continued branch May 7, 2026 12:33
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