Skip to content

Updated website search by integrating kapa.ai search functionality#896

Draft
n-boshnakov wants to merge 4 commits intogardener:masterfrom
n-boshnakov:add-kapa.ai-search-capability
Draft

Updated website search by integrating kapa.ai search functionality#896
n-boshnakov wants to merge 4 commits intogardener:masterfrom
n-boshnakov:add-kapa.ai-search-capability

Conversation

@n-boshnakov
Copy link
Contributor

@n-boshnakov n-boshnakov commented Mar 12, 2026

How to categorize this PR?

/kind enhancement

What this PR does / why we need it:
This PR:

  • replaces the regular search with kapa.ai's search functionality
  • hides the regular search box from appearing

kapa.ai's search functionality implements both semantic and keyword search, as opposed to the current search, which is keyword only.

Which issue(s) this PR fixes:
Fixes #898

Special notes for your reviewer:

Summary by CodeRabbit

Release Notes

  • New Features
    • Integrated search mode is now available with enhanced modal configuration
    • Command+K keyboard shortcut enabled for quick search access
    • Search modal interface updated for improved user experience and navigation

@n-boshnakov n-boshnakov requested a review from a team as a code owner March 12, 2026 15:42
@gardener-prow gardener-prow bot added the kind/enhancement Enhancement, improvement, extension label Mar 12, 2026
@netlify
Copy link

netlify bot commented Mar 12, 2026

Deploy Preview for gardener-docs ready!

Name Link
🔨 Latest commit 933cbe4
🔍 Latest deploy log https://app.netlify.com/projects/gardener-docs/deploys/69ba8ab2336d8700084a13dc
😎 Deploy Preview https://deploy-preview-896--gardener-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 54 (🔴 down 9 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 98 (no change from production)
PWA: 90 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@n-boshnakov n-boshnakov marked this pull request as draft March 12, 2026 15:42
@gardener-prow gardener-prow bot added cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 12, 2026
@gardener-prow
Copy link

gardener-prow bot commented Mar 12, 2026

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@gardener-prow gardener-prow bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 12, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 12, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 12f90d25-c2c1-4adf-ad4f-1c186a8b1e6a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

These changes integrate external search functionality by configuring metadata flags for an integrated search mode and disabling the default VitePress local search modal. The modifications add six configuration entries and a CSS rule to redirect search behavior.

Changes

Cohort / File(s) Summary
Search Integration Configuration
.vitepress/config.mts
Adds new head metadata entries to enable integrated search mode and modal behavior: data-search-mode: integrated, data-search-mode-enabled: true, data-modal-override-open-selector-search: div#local-search, data-modal-open-on-command-k: true, and data-modal-command-k-search-mode-default: true.
Default Search Modal Suppression
.vitepress/theme/style.css
Hides the built-in VitePress local search modal by applying display: none !important to the .VPLocalSearchBox class.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Add kapa.ai Search Assistant #871: Also modifies VitePress head configuration in .vitepress/config.mts to integrate an external search/AI assistant widget with metadata entries.

Suggested labels

size/S, needs-ok-to-test

Suggested reviewers

  • BoHristova
  • klocke-io

Poem

🐰 A rabbit hops through search settings bright,
Integrated modes now taking flight!
Hide the old modal, make way for new,
External search—a fresher view! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: integrating kapa.ai search functionality to replace the existing search system, which aligns with the file modifications in config.mts and style.css.
Description check ✅ Passed The PR description includes the required categorization (/kind enhancement), explains what the PR does and why it's needed, and provides special notes for reviewers.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

You can disable poems in the walkthrough.

Disable the reviews.poem setting to disable the poems in the walkthrough.

Copy link
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: 2

🧹 Nitpick comments (1)
.vitepress/config.mts (1)

306-309: Verify Cmd/Ctrl-K is not wired to both search implementations.

These flags add a second shortcut path while getSearchConfig() still keeps provider: 'local'. Please verify in preview that one keypress opens exactly one modal and focus lands in the kapa.ai search input; otherwise disable the VitePress local shortcut path when integrated search is enabled.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.vitepress/config.mts around lines 306 - 309, The current config sets
VitePress shortcut flags ('data-modal-open-on-command-k',
'data-modal-command-k-search-mode-default', 'data-search-mode-enabled') while
getSearchConfig() still returns provider: 'local', which can wire Cmd/Ctrl-K to
both search implementations; update the logic so that when the integrated search
provider (as returned by getSearchConfig()) is not 'local' you disable or remove
the VitePress local shortcut flags (e.g., do not set
'data-modal-open-on-command-k' and 'data-modal-command-k-search-mode-default' or
set them to 'false'), and ensure only one handler is active so a single keypress
opens exactly one modal and focus is moved to the kapa.ai input.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.vitepress/config.mts:
- Around line 300-309: The config currently sets 'data-consent-required' to
'true', which blocks the entire widget (including integrated search) until
consent; change the 'data-consent-required' entry to 'false' or remove that key
so integrated search ('data-search-mode': 'integrated') and Cmd/Ctrl+K behavior
('data-modal-command-k-search-mode-default') can open directly without the
consent screen, while optionally leaving other consent-related keys intact if
you still want to gate AI assistant features.

In @.vitepress/theme/style.css:
- Around line 110-113: Don't hide .VPLocalSearchBox by default; instead hide it
only after the external kapa.ai widget has confirmed it loaded (or leave local
search visible as a fallback). Implement this by removing the global "display:
none" and toggling visibility via a CSS state class (e.g.,
.external-search-ready .VPLocalSearchBox) or by adding/removing a class on body
when the kapa.ai init/load callback fires; ensure the script that initializes
kapa.ai (the widget load callback or init function) sets that class only on
successful load so the local search remains usable if the third‑party widget is
blocked/slow/down.

---

Nitpick comments:
In @.vitepress/config.mts:
- Around line 306-309: The current config sets VitePress shortcut flags
('data-modal-open-on-command-k', 'data-modal-command-k-search-mode-default',
'data-search-mode-enabled') while getSearchConfig() still returns provider:
'local', which can wire Cmd/Ctrl-K to both search implementations; update the
logic so that when the integrated search provider (as returned by
getSearchConfig()) is not 'local' you disable or remove the VitePress local
shortcut flags (e.g., do not set 'data-modal-open-on-command-k' and
'data-modal-command-k-search-mode-default' or set them to 'false'), and ensure
only one handler is active so a single keypress opens exactly one modal and
focus is moved to the kapa.ai input.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1e56e0bf-233a-439b-bf50-bec8f4059ec4

📥 Commits

Reviewing files that changed from the base of the PR and between 6380d32 and 35c3cad.

📒 Files selected for processing (2)
  • .vitepress/config.mts
  • .vitepress/theme/style.css

Comment on lines +300 to +309
'data-search-mode': 'integrated',
'data-consent-required': 'true',
'data-consent-screen-disclaimer': 'This AI assistant uses your questions to provide answers based on Gardener documentation. Your questions and interactions may be anonymously collected and analyzed to improve the search functionality and overall user experience. We don\'t collect any personally identifiable information. By clicking "Accept", you consent to using this AI-powered feature and the collection of your data. AI-generated responses may contain inaccuracies - please verify important information with the official documentation.',
'data-consent-screen-accept-button-text': 'I agree, let\'s chat!',
'data-consent-screen-reject-button-text': 'No, not interested',
'data-modal-example-questions': "How do I access my shoot cluster after it's created?,What happens during the daily maintenance window?,How do I configure worker nodes for my cluster?"
'data-modal-example-questions': "How do I access my shoot cluster after it's created?,What happens during the daily maintenance window?,How do I configure worker nodes for my cluster?",
'data-search-mode-enabled': 'true',
'data-modal-override-open-selector-search': 'div#local-search',
'data-modal-open-on-command-k': 'true',
'data-modal-command-k-search-mode-default': 'true'
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .vitepress/config.mts | sed -n '295,315p'

Repository: gardener/documentation

Length of output: 1721


🏁 Script executed:

# Search for any documentation or comments about the consent behavior in the config file
rg -A 5 -B 5 'data-consent-required' .vitepress/config.mts

Repository: gardener/documentation

Length of output: 1299


🏁 Script executed:

# Check if there are any PR descriptions or commit messages that explain the search behavior
git log --oneline -20 -- .vitepress/config.mts

Repository: gardener/documentation

Length of output: 108


🌐 Web query:

kapa.ai widget data-consent-required integrated search mode behavior documentation

💡 Result:

data-consent-required (Kapa website widget)

  • Set data-consent-required="true" to require a consent screen before a user can chat. When enabled, the widget sets a kapa_consent cookie in the user’s browser. You can also customize the consent screen title/disclaimer and accept/reject button text via the data-consent-screen-* parameters. [1]

“Integrated search mode” behavior (Kapa website widget)

  • Enable Search Mode: data-search-mode-enabled="true" adds a Search tab/mode so users can toggle between AI chat and search inside the widget. [2]
  • Make search the default view: data-search-mode-default="true" opens the widget directly in search mode (instead of Ask AI). [1], [2]
  • Integrate with your existing site search UI (open widget in search mode):
    • Use data-modal-override-open-selector-search="<css selector>" to bind an existing “Search” UI element (button/search bar) so it opens the Kapa widget in search mode. [1], [2]
    • (The FAQ also describes overriding an existing search trigger via the modal override selector approach.) [3]
  • Keyboard shortcut for search: data-modal-open-on-command-k="true" plus data-modal-command-k-search-mode-default="true" opens the widget with Cmd/Ctrl+K directly into search mode. [1], [2]
  • Programmatic control: window.Kapa.open({ mode: "search" }) (optionally with query) opens the widget directly in search mode. [2]

Sources

[1] Kapa Docs — Website Widget: Configuration (consent + search parameters) (docs.kapa.ai)
[2] Kapa Docs — Website Widget: Search Mode feature (docs.kapa.ai)
[3] Kapa Docs — Website Widget: FAQ (search mode / overriding existing search trigger) (docs.kapa.ai)

Citations:


🌐 Web query:

kapa.ai search widget consent configuration how it works

💡 Result:

To require end-user consent in the kapa.ai Website Widget (including when you use it as a “search widget” by enabling Search mode), you configure it via data-* attributes on the widget <script> tag. [1] (docs.kapa.ai)

How the consent configuration works

  • Default behavior: consent is not required. [1] (docs.kapa.ai)
  • Enable consent gate: set data-consent-required="true". When enabled, the widget will show a consent screen and, upon acceptance, it sets a browser cookie named kapa_consent to remember the choice. [1] (docs.kapa.ai)
  • Customize the consent screen text/buttons (all optional):
    • data-consent-screen-title
    • data-consent-screen-disclaimer
    • data-consent-screen-accept-button-text
    • data-consent-screen-reject-button-text [1] (docs.kapa.ai)

Minimal example

<script
  async
  src="https://widget.kapa.ai/kapa-widget.bundle.js"
  data-website-id="XXX-XXX-XXX"
  data-project-name="Your Project"
  data-project-color="#6306B6"
  data-project-logo="https://example.com/logo.png"
  data-search-mode-enabled="true"
  data-consent-required="true"
  data-consent-screen-title="Hi there, do you want to use the AI chat?"
  data-consent-screen-disclaimer='By clicking "I agree, lets chat!" you agree to the necessary cookies. See our privacy policy.'
  data-consent-screen-accept-button-text="I agree, lets chat!"
  data-consent-screen-reject-button-text="No, not interested"
></script>

If you tell me which consent tool you use (Cookiebot, OneTrust, etc.), I can suggest the typical pattern for only calling window.Kapa.render() after consent (using data-render-on-load="false"). [1] (docs.kapa.ai)

Citations:


Integrated search is still gated by consent requirement.

Line 301 keeps data-consent-required: 'true', which blocks access to the entire widget (including search mode) until the user accepts the consent screen. Even though lines 308–309 configure Cmd/Ctrl+K to open directly in search mode, the consent screen still appears first. Per the kapa.ai widget documentation, data-consent-required applies to all widget functionality. If the PR goal is to let users access search without consent, remove data-consent-required or set it to 'false' to allow search to function freely while optionally gating only the AI assistant features.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.vitepress/config.mts around lines 300 - 309, The config currently sets
'data-consent-required' to 'true', which blocks the entire widget (including
integrated search) until consent; change the 'data-consent-required' entry to
'false' or remove that key so integrated search ('data-search-mode':
'integrated') and Cmd/Ctrl+K behavior
('data-modal-command-k-search-mode-default') can open directly without the
consent screen, while optionally leaving other consent-related keys intact if
you still want to gate AI assistant features.

Comment on lines +110 to +113
/* Hide VitePress local search modal to use kapa.ai search instead */
.VPLocalSearchBox {
display: none !important;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Keep a fallback when the external search widget is unavailable.

This hides the built-in search modal before the kapa.ai widget proves it loaded. If the third-party script is blocked, slow, or down, the navbar search trigger and Cmd/Ctrl-K end up pointing at a hidden UI and search disappears entirely. Hide .VPLocalSearchBox only after the external widget is ready, or keep local search as a fallback.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.vitepress/theme/style.css around lines 110 - 113, Don't hide
.VPLocalSearchBox by default; instead hide it only after the external kapa.ai
widget has confirmed it loaded (or leave local search visible as a fallback).
Implement this by removing the global "display: none" and toggling visibility
via a CSS state class (e.g., .external-search-ready .VPLocalSearchBox) or by
adding/removing a class on body when the kapa.ai init/load callback fires;
ensure the script that initializes kapa.ai (the widget load callback or init
function) sets that class only on successful load so the local search remains
usable if the third‑party widget is blocked/slow/down.

@n-boshnakov n-boshnakov self-assigned this Mar 16, 2026
@gardener-prow
Copy link

gardener-prow bot commented Mar 16, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from n-boshnakov. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

- Implemented a custom consent management system, with dual-mode widget loading
- Added css and dark mode fixes for various cases of user consent
- Search is now on by default, a cogwheel icon allows the user to enable the AI Assistant
- Custom icon in the lower right corner of the screen shows the users that a chat option is available on a first visit, before they have given their consent to data sharing
@gardener-prow gardener-prow bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/enhancement Enhancement, improvement, extension needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement kapa.ai semantic search in website

1 participant