Skip to content

Conversation

@wreiske
Copy link
Member

@wreiske wreiske commented Feb 12, 2026

Summary

Adds support for URL-driven search so that links like https://docs.enterprisehealth.com/#search=test automatically open the search modal with results.

Changes

Hash-to-query redirect (baseof.html)

  • Early inline <script> in <head> redirects #search=...?q=... before the page renders (no flash of content)
  • Uses window.location.replace() so the hash URL doesn't pollute browser history

Search modal enhancements (main.js)

  • ?q= query param support: On page load, if ?q=test is present, the search modal opens pre-filled with the query and results are shown
  • Skeleton loader: 5 animated placeholder rows appear immediately while the search index loads, so the UI feels instant
  • Non-blocking index build: The lunr index is now built using lunr.Builder with chunked add() calls (200 docs per chunk), yielding to the browser between chunks via setTimeout(0) to keep the UI responsive
  • URL cleanup: ?q= param is removed from the URL via history.replaceState() when the search modal is closed
  • Concurrent load guard: Prevents duplicate index loads if multiple callers trigger loadSearchIndex() simultaneously

SEO alignment

  • The existing SearchAction structured data in baseof.html already declares ?q={search_term_string} as the search URL template — this implementation matches that contract

Testing

  • Navigate to /#search=test → should redirect to /?q=test and show search results
  • Navigate directly to /?q=scheduling → modal opens with "scheduling" pre-filled and skeleton → results
  • Close modal → URL bar no longer has ?q=
  • Normal search via Cmd/K still works as before

- Support #search=... hash URLs by redirecting to ?q=... (SEO-friendly)
- Early redirect in <head> prevents flash of content
- Auto-open search modal with pre-filled query on ?q= page load
- Add animated skeleton loader while search index loads
- Build lunr index in chunks (non-blocking) to keep UI responsive
- Clean up ?q= param from URL when search modal is closed
- Aligns with existing SearchAction structured data in baseof.html
@github-actions
Copy link

👋 @wreiske, Your documentation has been pushed to https://docs-qa.med-web.com/128-merge/ for commit 6f26f85

- /eh/videos/* → https://videos.enterprise.health/videos/*
- /wc/videos/* → https://videos.webch.art/videos/*
- 301 permanent redirect preserving path and query string
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 12, 2026

Deploying wc-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 42c26d4
Status: ✅  Deploy successful!
Preview URL: https://079a4b99.wc-docs.pages.dev
Branch Preview URL: https://feature-url-driven-search.wc-docs.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link

Deploying eh-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 42c26d4
Status: ✅  Deploy successful!
Preview URL: https://c32c17f4.eh-docs.pages.dev
Branch Preview URL: https://feature-url-driven-search.eh-docs.pages.dev

View logs

@wreiske wreiske merged commit 97ad9d3 into master Feb 12, 2026
1 of 3 checks passed
@wreiske wreiske deleted the feature/url-driven-search branch February 12, 2026 17:11
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.

1 participant