Search
Note
This feature is available in standalone mode only.
If you’re not passing the -embed
flag,
you’re in standalone mode.
If you want search in embedded mode, use the static site generator you’re embedding into to give you search functionality, or plug Pagefind into the generated site.
doc2go can include a search box in your generated website, allowing users to perform full-text search across your documentation. This functionality is powered by Pagefind, making this entirely client-side and static.
Try out one of the following examples:
Enabling search
By default, the search functionality is enabled automatically
if pagefind is found installed on your system $PATH
.
Use the official installation instructions
to install pagefind on your system.
You can explicitly enable or disable search with the -pagefind
flag:
doc2go -pagefind ./... # enabled
doc2go -pagefind=false ./... # disabled
If you have pagefind installed in a non-standard location, pass that location instead of true or false:
doc2go -pagefind=path/to/pagefind ./...
Project-local installation
If you’d like to keep the installation of pagefind local to your project,
you can install it with NPM and pass the location to the -pagefind
flag.
Take the following steps:
Install pagefind with NPM:
npm install pagefind@latest
This will create a
node_modules/.bin/pagefind
executable.Run doc2go with this path as an argument:
doc2go -pagefind=node_modules/.bin/pagefind ./...