This page is a demo for the Static-Site-Search search engine. It is not an automatically generated page, but is instead intended to show how you might include the output from the Static-Site-Search program in your website.
This page includes the preload.js script, which is part of the output of Static-Site-Search, in its <head> element. This script preloads the index files for the search engine for your site, which are output by Static-Site-Search, so that when the user makes a search query, it can be answered quickly. The preloaded files are stored in the user's browser's localStorage, which usually can store at least 5MB of data, and is persistent, unless the user uses a Private Browsing session (in which case the storage persists only for that session), or the user manually clears their browser data. The script contains an expiry time parameter, after which it will clear the preloaded index files from the browser and re-download them. Because this caching is implemented in JavaScript, you (the website owner) have control over it, so you can change the expiry time even if you can't change the Cache-Control or similar headers sent by your site's webserver, as is likely to be the case if you are using a public hosting service like GitHub Pages.
You should include the preload.js script on every page of your site (except the HTML page generated automatically by Static-Site-Search itself) so that the index files will be stored in your users' caches as soon as they visit any page. You can use the defer attribute of the <script> tag in order to ensure that the script is executed (and therefore starts any downloads of index files) after the rest of the page has been parsed, which means that the effect on the performance of your website of using Static-Site-Search should be minimal. You can look at the source of this page to see what the <script> tag should look like. In this page, it is in the <head>, but you could include it anywhere.
The preload.js script will also automatically bind some JavaScript to an appropriate <input> and <button> element so that when the user types a query and presses the button (or the Enter key), they are redirected to the search.html page (which is also generated by Static-Site-Search) and their search is performed. All you need to do is to ensure that on each page where you want a search bar and search button, you have an <input> element with its id attribute set to "static-site-search-bar", and a <button> element with its id set to "static-site-search-button".
Below is an example of some suitable <input> and <button> elements. (They are shown here inside an HTML table, but you probably want to use some of your own CSS rather than copying that.) They are linked to a search.html page which is set up to search the website Contemporary Home Computing (which is not a website I am affiliated with, but am just using as an example). Static-Site-Search found and indexed 239 pages on this website, some of which contain quite a lot of text, and the resulting index files total 473 KiB in size, i.e. just less than 0.5MB. This is less than the size of one high resolution JPEG photo, so if your site is smaller than a few hundred pages, Static-Site-Search will probably work for you. Also in the table below is a form to search the same website on Google, so that you can perform some queries and compare the results.
| Search Contemporary Home Computing with Static-Site-Search: | |
N.B. Some results appear in Google results but not in the Static-Site-Search results. Sometimes this is because Google does more linguistic processing of search terms. However the crawlers also behave differently: Google includes in its site search HTTP redirects from contemporary-home-computing.org URLs to pages on other (sub)domains, whereas Static-Site-Search is intended to index specific websites, so does not. For example results from the subdomain userrights.contemporary-home-computing.org appear in the Google results via a redirect from the main website, but do not appear in the Static-Site-Search results. However you can include this domain (or any other) in the Static-Site-Search crawl as well by giving the subdomain userrights.contemporary-home-computing.org as an extra command line argument. See the GitHub page for more information.