An open API service indexing awesome lists of open source software.

https://github.com/hydephp/hydesearch

#CodingInPublic
https://github.com/hydephp/hydesearch

Last synced: 10 months ago
JSON representation

#CodingInPublic

Awesome Lists containing this project

README

          

# Experimental Frontend Search Engine for Hyde Documentation Sites

![jsDelivr hits (GitHub)](https://img.shields.io/jsdelivr/gh/hm/hydephp/hydesearch)
[![jsDelivr hits (NPM)](https://data.jsdelivr.com/v1/package/npm/hydesearch/badge?style=rounded)](https://www.jsdelivr.com/package/npm/hydesearch)
![NPM Downloads](https://img.shields.io/npm/dm/hydesearch)
[![Build](https://github.com/hydephp/hydesearch/actions/workflows/build.yml/badge.svg)](https://github.com/hydephp/hydesearch/actions/workflows/build.yml)
[![CodeQL](https://github.com/hydephp/hydesearch/actions/workflows/codeql.yml/badge.svg)](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


Valid HTML5