feat: URL-driven search with skeleton loader #128
Merged
+145
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for URL-driven search so that links like
https://docs.enterprisehealth.com/#search=testautomatically open the search modal with results.Changes
Hash-to-query redirect (
baseof.html)<script>in<head>redirects#search=...→?q=...before the page renders (no flash of content)window.location.replace()so the hash URL doesn't pollute browser historySearch modal enhancements (
main.js)?q=query param support: On page load, if?q=testis present, the search modal opens pre-filled with the query and results are shownlunr.Builderwith chunkedadd()calls (200 docs per chunk), yielding to the browser between chunks viasetTimeout(0)to keep the UI responsive?q=param is removed from the URL viahistory.replaceState()when the search modal is closedloadSearchIndex()simultaneouslySEO alignment
SearchActionstructured data inbaseof.htmlalready declares?q={search_term_string}as the search URL template — this implementation matches that contractTesting
/#search=test→ should redirect to/?q=testand show search results/?q=scheduling→ modal opens with "scheduling" pre-filled and skeleton → results?q=