Product Dev Back to Ghost

How to add Google Custom Search to your Ghost blog

Note:You will need to edit your theme files to add Google Custom Search. If you're not familiar with how to edit your theme, please see our guide on making theme edits here.

To add in Google Custom search, you will first need to create a search engine for your site. You can do this by going to Google's Custom Search site.

Google Custom Search

If you'd like your entire blog to be searched, you will need to type in* into the "sites to search" field. Please note the * at the end of the URL.

Ghost Custom Search Entire Site

When you've finished, give your search engine a name, then click the blue "Create" button to continue the process of setting up your custom search engine.

Create search engine

After you've created the custom search engine, you will be taken to a screen that provides you with several options. Select the "get code" button next to the "Add it to your site" option.

Get custom search code

Upon clicking the "get code" button, you should be directed to a screen with your custom search engine code. Copy and paste the provided code into a <div> element within your site's <body> section, where you want both the search box and the search results to render.

For those looking for another alternative to Google Custom Search, checkout Swiftype.