Conversation
review · 5 starsThis plugin is a gem of a gift to the WordPress community. Embedding a modern and performant search interface into your website couldn’t possibly be easier. The plugin uses the Algolia open-source vanilla JS libraries “InstantSearch.js” and “Autocomplete.js”, which communicate with your Typesense server using fetch requests in the browser; no connection to WordPress needed, and thus fully compatible with static generation. Via their WP-Admin GUI, the software indexes your WP posts and pages as Typesense “documents” and “collections”; while the frontend search interface fetch es data direct from your Typesense instance. I used the Typesense provided Docker image to spin up a self-hosted instance; added my instance API keys to the Typesense plugin settings in WP-Admin; indexed 4000+ posts in a couple minutes; added the default shortcode to a test page; ran a SimplyStatic export, and voilà, it works splendidly! Important note for static site generation: Prior to running an index, you’ll need to filter the permalink; otherwise the search results will link to your WP: /** * Filter Typesense document data before it is indexed. **/ add_filter( 'cm_typesense_data_before_entry', function( $formatted_data, $raw_data, $object_id ) { if ( isset( $formatted_data['permalink'] ) ) { $formatted_data['permalink'] = str_replace( 'wp[dot]example[dot]com', 'example[dot]com', $formatted_data['permalink'] ); } return $formatted_data; }, 10, 3 ); * WordPress[dot]org doesn’t permit URLs in reviews, hence why the [dot] chicanery in the above snippet. Pax et bonum.
No comments were stored for this source.