Section 27.8 Search
Search facilities are enabled through
Google Custom Search Engine . Please, please report any discrepancies in the following instructions as the setup interface at Google changes out from underneath us. These instructions have been updated as of 2020-10-01. 1
Besides being useful for search facilities, setting up a search engine might be a good way to alert Google of something newly available, and initiate your book's rise up the search results rankings.
List 27.8.1 . Configuring Google Custom Search
Create an account with Google (GMail, YouTube, etc.) and make sure you are signed in.
GCSE and add a new search engine via
New Search Engine.
URL for the top-level domain name/directory for your book/document. Everything below this will be indexed. We have taken some care to mark knowl content in a way compatible with the search facility, but there is more work to do here.
Give the engine a GCSE-specific name, so you can tell later which one it is when you have several.
Edit Search Engine in the
Basics tab locate
Search engine ID which has a string that uniquely identifies your new search engine. Save this, you'll need to make it part of your PreTeXt document.
Users tab add co-authors or trusted backup personnel.
Edit Search Engine > Look and Feel at your own risk! Only the defaults are tested and supported.
Provisions for removing advertisements for non-profit sites seem to have changed. If your university already contracts with Google, you should investigate having a “SuperAdmin” at your institution so this setup for you, and make you a trusted collaborator. Then it should be an easy matter to turn off advertisements.
List 27.8.2 . Configuring PreTeXt for Google Search
Because these sign-ups are dependent on your site, this is a publisher activity, and hence configured with the publisher file (
Section 26.1), see Subsection 40.4.8 for details.
Search engine ID you saved from above is referenced in Google's code as a
cx number. An example looks like
482cf73dc05bed674 (older examples looked like
002673997130187229905:qjo2y0jplyu). In which case your publisher file would have an element under
search/@google-cx attribute will alert the PreTeXt conversion and fully enable and implement search. You are done, and everything should just work. You should see a Google-branded search box to the top right of each of your pages. (We have no control over the branding.)
Time to rebuild your
HTML output and make the improved version available.