pkgdown websites can integrate search capability using Docsearch from Algolia. Docsearch is a powerful search engine that is free for documentation websites. There are only two steps needed to enable Docsearch on a pkgdown website.
Once you have published your pkgdown website, submit the pkgdown site URL to Docsearch. Docsearch will contact you via e-mail to confirm you are the website owner.
Docsearch will set up a crawler configuration that indexes your site every 24 hours. pkgdown builds a suggested Docsearch crawler configuration in
docsearch.json and you should point the Docsearch team to this configuration as a starting point. If you want to optimize your search, Docsearch will accept pull requests to the configuration that incorporate additional options to fine tune the scraping.
Put the value of the
indexName parameters into your site
You also need to add a
url: field to
_pkgdown.yml that specifies the location of your documentation on the web. For pkgdown, the URL field is:
If you are building your own custom Docsearch index, you can also include your Docsearch
See the pkgdown configuration for a functional search configuration.
Once this configuration is complete, you should find a search bar after re-building your site. After search is enabled, pressing
/ (i.e., “?”) will move the focus to the search bar.