Using Google Custom Search
If you want to include Search functionality on your docs site, you need to set up a Google Custom Search, and then link it to your nbdev project. Here's all the steps you need to follow (replace anything in {} with the value your have in settings.ini:
- Go to Google Custom Search and click 'add'.
- In "Sites to search" type the URL of your docs site (e.g.
{owner}.github.io/{lib_name}), and in "Name of the search engine" type "{lib_name} docs". Then click "CREATE" - Click "Control Panel"
- In the "Basics" tab, click "Copy to clipboard" in the "Search engine ID" row
- Paste that as the value for "google_search:" in
docs/_config.ymlin your project. (If you don't already have this file, runnbdev_build_libto create it, once you've set up yoursettings.ini) - Click "Advanced" (far-right tab), then "CSE Context", then "Download (XML)"
- Open the downloaded
cse.xmlfile in a text editor, and delete everything from the line starting with<LookAndFeelonwards (including that line) - Replace those lines with the contents of this file: search-template.txt, and save it
- In your browser, in the same "Advanced" tab you downloaded
cse.xmlfrom, clickUpload XML fileand upload the updatedcse.xmlfile you just save.
- To see what documents google is currently indexing at any particular URL, use the site: operator without any search term. e.g. "site:docs.fast.ai". You can use this to sense check what a search term ought to return as the result
- If Google isn't indexing your docs site, you can ask it to do so by following these instructions.