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.yml
in your project. (If you don't already have this file, runnbdev_build_lib
to create it, once you've set up yoursettings.ini
) - Click "Advanced" (far-right tab), then "CSE Context", then "Download (XML)"
- Open the downloaded
cse.xml
file in a text editor, and delete everything from the line starting with<LookAndFeel
onwards (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.xml
from, clickUpload XML file
and upload the updatedcse.xml
file 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.