Skip to content

sample search implementation#589

Open
pnbrown wants to merge 3 commits into
valkey-io:mainfrom
pnbrown:add-search
Open

sample search implementation#589
pnbrown wants to merge 3 commits into
valkey-io:mainfrom
pnbrown:add-search

Conversation

@pnbrown

@pnbrown pnbrown commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Added Algolia site verification and DocSearch integration.

Description

Adds a sample search implementation
Keys are search only and specific to this reference implementation will be rotated for account managing algolia application

Issues Resolved

closes #81

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the BSD-3-Clause License.

Added Algolia site verification and DocSearch integration.

Signed-off-by: Nigel Brown <pnigelbrown@gmail.com>
@pnbrown
pnbrown requested a review from rlunar June 29, 2026 12:31
@pnbrown
pnbrown requested a review from stockholmux as a code owner June 29, 2026 12:31
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@pnbrown, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4190e23b-72d2-4515-a8d8-b2a802fabc66

📥 Commits

Reviewing files that changed from the base of the PR and between eeca382 and 24ece4f.

📒 Files selected for processing (2)
  • templates/default.html
  • templates/includes/head.html
📝 Walkthrough

Walkthrough

The templates/default.html template is updated to integrate Algolia DocSearch: a CSS link and site verification meta tag are added to the head block, a div#docsearch container is inserted in the navigation, and @docsearch/js@4 is loaded and initialized with appId, indexName, and apiKey at the end of the document.

Changes

Algolia DocSearch Integration

Layer / File(s) Summary
DocSearch CSS, mount point, and JS initialization
templates/default.html
Adds DocSearch CSS and Algolia site verification meta tag to the head block, inserts a div#docsearch mount point in the navigation area, and loads @docsearch/js@4 with docsearch(...) initialization using container, appId, indexName, and apiKey.

Assessment against linked issues

Objective Addressed Explanation
Add search functionality to the valkey.io website [#81]

Out-of-scope changes

No out-of-scope changes found.


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.

@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: 2

🤖 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 `@templates/default.html`:
- Around line 1-4: The DocSearch head block is rendering before the document
doctype, so move the existing head contents from the top of the template into
the actual <head> section after <!DOCTYPE html>. Keep the unique `block head`
content (`@docsearch/css@4` stylesheet link and `algolia-site-verification`
meta) inside the page’s `<head>` so `<!DOCTYPE html>` remains the first rendered
token.
- Line 2: The DocSearch assets are loaded from floating major CDN URLs without
integrity protection, so update the stylesheet and script tags in the default
template to use pinned exact versions for both `@docsearch/css` and `@docsearch/js`,
and add matching integrity plus crossorigin="anonymous" attributes on each tag.
Locate the existing DocSearch includes in the default HTML template and make the
same change for both asset references so the loaded content is fixed and
verifiable.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dd79c8e5-b3fd-409c-8e4c-a788424d625d

📥 Commits

Reviewing files that changed from the base of the PR and between 282a117 and eeca382.

📒 Files selected for processing (1)
  • templates/default.html

Comment thread templates/default.html
Comment on lines +1 to +4
{%- block head -%}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@4" />
<meta name="algolia-site-verification" content="D96477DE35118476" />
{%- endblock -%}<!DOCTYPE html>

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep <!DOCTYPE html> as the first rendered token.

Line 4 currently emits the doctype after the new DocSearch <link> and verification <meta>, which violates doctype-first and can affect document parsing. Move this block into the actual <head> after the doctype.

Proposed placement
-{%- block head -%}
-  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@4" />
-  <meta name="algolia-site-verification"  content="D96477DE35118476" />
-{%- endblock -%}<!DOCTYPE html>
+<!DOCTYPE html>

Then place the block contents inside the existing <head> element.

🧰 Tools
🪛 HTMLHint (1.9.2)

[error] 1-1: Doctype must be declared before any non-comment content.

(doctype-first)

🤖 Prompt for 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.

In `@templates/default.html` around lines 1 - 4, The DocSearch head block is
rendering before the document doctype, so move the existing head contents from
the top of the template into the actual <head> section after <!DOCTYPE html>.
Keep the unique `block head` content (`@docsearch/css@4` stylesheet link and
`algolia-site-verification` meta) inside the page’s `<head>` so `<!DOCTYPE
html>` remains the first rendered token.

Source: Linters/SAST tools

Comment thread templates/default.html Outdated
@@ -1,4 +1,7 @@
{%- block head -%}{%- endblock -%}<!DOCTYPE html>
{%- block head -%}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@4" />

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.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

: "${DOCSEARCH_VERSION:?Set an exact DocSearch version, e.g. 4.x.y}"

for pkg in css js; do
  url="https://cdn.jsdelivr.net/npm/@docsearch/${pkg}@${DOCSEARCH_VERSION}"
  hash="$(curl -fsSL "$url" | openssl dgst -sha384 -binary | openssl base64 -A)"
  printf '%s\nintegrity="sha384-%s"\n\n' "$url" "$hash"
done

Repository: valkey-io/valkey-io.github.io

Length of output: 243


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the template and find DocSearch references.
git ls-files templates/default.html
nl -ba templates/default.html | sed -n '1,220p'
printf '\n--- docsearch refs ---\n'
rg -n '`@docsearch`|jsdelivr|integrity|crossorigin' templates/default.html

Repository: valkey-io/valkey-io.github.io

Length of output: 230


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- templates/default.html ---'
cat -n templates/default.html | sed -n '1,220p'

printf '\n%s\n' '--- docsearch refs ---'
rg -n '`@docsearch`|jsdelivr|integrity|crossorigin' templates/default.html

Repository: valkey-io/valkey-io.github.io

Length of output: 7926


Pin the DocSearch CDN assets.
@docsearch/css@4 and @docsearch/js@4 are loaded from floating major URLs without SRI. Use exact versions and add integrity plus crossorigin="anonymous" on both tags so upstream CDN/package changes can’t alter every page. (templates/default.html:2,145)

🤖 Prompt for 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.

In `@templates/default.html` at line 2, The DocSearch assets are loaded from
floating major CDN URLs without integrity protection, so update the stylesheet
and script tags in the default template to use pinned exact versions for both
`@docsearch/css` and `@docsearch/js`, and add matching integrity plus
crossorigin="anonymous" attributes on each tag. Locate the existing DocSearch
includes in the default HTML template and make the same change for both asset
references so the loaded content is fixed and verifiable.

@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds Algolia DocSearch to the site templates. The main changes are:

  • Adds Algolia site verification metadata to the shared head include.
  • Loads the DocSearch stylesheet from jsDelivr in templates/includes/head.html.
  • Adds a #docsearch container to the main navigation.
  • Initializes DocSearch in templates/default.html with the configured Algolia app, index, and search-only key.

Confidence Score: 5/5

The template-only DocSearch integration appears safe to merge.

The changes are small, localized to shared templates, and no blocking correctness or security issues were identified.

T-Rex T-Rex Logs

What T-Rex did

  • Before evidence, the homepage had no algolia-site-verification meta, no DocSearch CSS or JS, no #docsearch host or button, and the navigation text ended with the GitHub star count.
  • After evidence, the page shows DocSearch is integrated, including the verification meta content D96477DE35118476, requests for jsdelivr to load @docsearch/css@4 and @docsearch/js@4, an init script configured with appId, indexName, and apiKey, and a rendered DocSearch button with Search/Ctrl/K in the main navigation.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (2): Last reviewed commit: "Add Algolia site verification meta tag a..." | Re-trigger Greptile

Comment thread templates/default.html
pnbrown added 2 commits June 29, 2026 18:08
Removed unused stylesheet and meta verification from head block.

Signed-off-by: Nigel Brown <pnigelbrown@gmail.com>
Signed-off-by: Nigel Brown <pnigelbrown@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add search functionality to https://valkey.io/ website

1 participant