https://github.com/hydephp/hydesearch
#CodingInPublic
https://github.com/hydephp/hydesearch
Last synced: 10 months ago
JSON representation
#CodingInPublic
- Host: GitHub
- URL: https://github.com/hydephp/hydesearch
- Owner: hydephp
- Created: 2022-05-26T19:41:25.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-05-29T06:25:00.000Z (over 3 years ago)
- Last Synced: 2025-03-24T05:46:07.027Z (10 months ago)
- Language: TypeScript
- Homepage: https://demos.desilva.se/gist/github/hydephp/experiments/hydesearch
- Size: 87.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Experimental Frontend Search Engine for Hyde Documentation Sites

[](https://www.jsdelivr.com/package/npm/hydesearch)

[](https://github.com/hydephp/hydesearch/actions/workflows/build.yml)
[](https://github.com/hydephp/hydesearch/actions/workflows/codeql.yml)
## #CodingInPublic
Contains both the frontend interface and the TypeScript source code for the plugin.
## Usage
Add the following snippet to your HTML to define the position of the search input:
```html
The search feature requires JavaScript to be enabled in your browser.
```
Then, load and initialize the plugin:
```html
window.addEventListener('load', function() {
// Replace with the HTTP location of your JSON search index.
// Note that HydeSearch assumes the JSON is safe and trusted. Use strict CORS policies.
const searchIndexLocation = 'tests/search.json';
const Search = new HydeSearch(searchIndexLocation);
Search.init();
});
```
## Contributing
PRs, issues, and feedback are welcome! I'd especially love to get help writing tests!
## Development
While this tool was created to be used with HydePHP, and thus is rather opinionated,
I imagine it can easily be used with any other static site generator.
If developing a third party integration, make sure that the generated JSON follows the expected
[searchindex schema](https://cdn.desilva.se/storage/permanent/2022/schemas/hydesearch/schema-draft.json).
## License
The MIT License
## Extra