Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gbxyz/webidx
webidx is a client-side search engine for static websites.
https://github.com/gbxyz/webidx
javascript perl search-engine sqlite static-site web
Last synced: 2 months ago
JSON representation
webidx is a client-side search engine for static websites.
- Host: GitHub
- URL: https://github.com/gbxyz/webidx
- Owner: gbxyz
- License: bsd-3-clause
- Created: 2024-01-23T17:00:37.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-24T10:38:02.000Z (11 months ago)
- Last Synced: 2024-09-29T18:41:19.456Z (3 months ago)
- Topics: javascript, perl, search-engine, sqlite, static-site, web
- Language: Perl
- Homepage: https://github.com/gbxyz/webidx
- Size: 21.5 KB
- Stars: 58
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# webidx
webidx is a client-side search engine for static websites.
It works by using a simple Perl script ([webidx.pl](webidx.pl)) to generate an SQLite database containing an index of static HTML files. The SQLite database is then published alongside the static content.
The search functionality is implemented in [webidx.js](webidx.js) which uses [sql.js](https://github.com/sql-js/sql.js) to provide an interface to the SQLite file.
You can see a live demo of it [here](https://gavinbrown.xyz/webidx-demo/).
## How to use it
1. use [webidx.pl](webidx.pl) to generate the index:
```
$ /path/to/webidx.pl -x index.html -x archives.html --xP secret_files -o https://example.com -z . ./index.db
```You can run `webidx.pl --help` to see all the available command-line options.
2. Include [sql.js](https://cdnjs.com/libraries/sql.js), [pako](https://cdnjs.com/libraries/pako) and [webidx.js](webidx.js) in your web page:
```html
```
3. Create a search form:
```html
```
When the user hits the return key in the search box, a modal dialog will pop up containing search results!
The object that's passed to `window.webidx.search()` can have the following properties:
* `dbfile`: URL of the SQLite database file
* `query`: search query
* `resultCallback`: a callback which is passed an array of search results. Each result is an object with the `title` and `url` properties. If not defined, a modal dialog will be displayed.
* `errorCallback`: a callback which is passed any error string as an argument.
* `titleSuffix`: a string to be removed from the end of page titles.
* `titlePrefix`: a string to be removed from the beginning of page titles.