How to add a search box that finds anything on your site (Instant search)
In TeleportHQ, the Instant search plugin gives your site one search for everything: in the left sidebar, click Plugins, click Instant search and turn on Instant search enabled. TeleportHQ puts a search control in your navigation and adds a Search component, a full-screen search window you can restyle. On your published site, visitors click the control, or press Ctrl+K (⌘K on a Mac) or /, and see matching pages, products, blog posts, help articles and bookable items as they type.
Before you start
- Instant search needs a navigation, because its search control goes into it. If your project has none, TeleportHQ offers to add one when you switch the plugin on. A project with the dashboard layout (a sidebar instead of a top navigation) has no place for the control: its Instant search row in Plugins reads Needs a top navigation, and the plugin can't be switched on.
- Every plan has it. Instant search works on websites and web apps, doesn't turn a website into a web app, and adds nothing to your database.
- Role. You need a role that can change project settings: Owner, Admin or Designer.
Turn on Instant search
- In the TeleportHQ editor, in the left sidebar, click Plugins.
Under Search & discovery, click Instant search. Its settings open in a drawer next to the list.
- Under Feature, click the Instant search enabled switch. The Turn on Instant search window opens.
- Read its three steps (Navigation, Results and Preview) with Next, or click Skip.
- Click Turn on Instant search.
A message lists what TeleportHQ added, and the Instant search is ready! card offers a short tour: click Show Me to watch it, or Maybe Later. You can play the tour again from the drawer with Start tutorial.
If your project has no navigation yet, the Add a navigation first? window opens right after step 3. Click Add navigation and continue: TeleportHQ adds a plain navigation with links to your pages on every page, then opens Turn on Instant search. You can restyle that navigation later like any component.
What Instant search adds to your project
Switching on the TeleportHQ Instant search plugin adds two things:
- A search control in your navigation. By default it's a search icon, placed ahead of the cart and account buttons when your site has them, with a copy in the menu your navigation opens on phones. Clicking it opens the search.
- The Search component. It's the search window itself: a Search title, a line that names what it searches (for example "Find pages, products and blog posts on this site."), the search field with a button that clears it, a close button (✕) and one list of results per kind of content. You find it in Pages, Components & Tree View, under Components, in a folder named Instant search. Your published site draws it on every page and shows it when a visitor opens the search.
Your navigation already has a search icon, field or link? Instant search uses that one instead of adding a second control. A message says, for example, "Your navigation’s search icon now opens the search." Whatever that element did before is paused while the plugin is on, and comes back when you switch Instant search off. If the Turn on Instant search window lists your element under Use what your pages already have, keep its switch on to use it, or turn it off to get the plugin's own control.
Instant search settings
The TeleportHQ Instant search drawer lists every setting below the switch. They're greyed out until the plugin is on. Each change saves at once, and visitors get it the next time you publish: the editor says "A publish brings the change to visitors."
Search control
| Setting | What it does | Default |
|---|---|---|
| In the navigation | The look of the control the plugin adds: A search icon or A search field (a small box that looks like a field). Changing it rebuilds the control. It's not used when your navigation's own search element opens the search. | A search icon |
| Keyboard shortcuts | "Cmd/Ctrl+K and / open the search anywhere on the site." / works when the visitor isn't typing in a field. | On |
| Placeholder | "What the empty search field says." Up to 60 characters. It's also the name screen readers announce for the control. | Search… |
Results
| Setting | What it does | Default |
|---|---|---|
| What is searched | Tick the kinds of content to search: Pages, Products, Blog posts, Help articles and Bookable items. "A section shows only while its feature is on": for example, Products needs E-commerce. | All five |
| Results per section | "Each kind lists this many results at most." From 1 to 10. | 5 |
| Search from | "How many characters before results appear." From 1 to 3. | 2 |
| Wait after typing | How many milliseconds the site waits after the visitor stops typing before it searches. From 0 to 1000. | 300 |
A number outside its range is set to the nearest allowed value.
Restyle the Search component
The TeleportHQ Search component is yours: change its words, colors, fonts and layout like any other component.
- In the left sidebar, click Pages, Components & Tree View.
- Under Components, open the Instant search folder and click Search. The search opens on the canvas, empty, the way a visitor first sees it.
- Select the part you want to change, for example the Search title, and edit it in the right panel.
Above the canvas, a note reads "Your Search: the full-screen modal the search in your navigation opens." Its Plugin settings button opens the Instant search drawer, and How it works plays the tour. See How to edit a component and update every copy.
To restyle the control in your navigation, open your navigation component and select the search icon or field there.
Preview the search in the editor
The search doesn't run on the canvas: typing in the Search component's field there changes nothing. To see each state, open the Search component (see above) and use the switch at the top of the canvas:
- Empty: the search as it opens.
- Typing: a word too short to search, with "Type a little more to search."
- Searching: every list loading, with "Searching…".
- Results: real results for a word from your own content. A kind you have nothing of yet shows a sample row, for example "A product of your shop".
- Nothing found: every list saying no match.
To try the real search, publish your site, or publish it to staging first. See How to test changes on a staging site before going live.
What visitors see
On your published TeleportHQ site, Instant search works like this:
- A visitor clicks the search control, or presses Ctrl+K (⌘K on a Mac) or
/while Keyboard shortcuts is on. The search opens over the page with the cursor in the field. - Until they type as many characters as Search from asks, the search says "Type a little more to search."
- Once they stop typing for the Wait after typing time, each list shows "Searching…", then its results: a title, a short description and a picture when the result has one. A list with nothing to show reads, for example,
No products match “cake”. - Clicking a result opens its page and closes the search. Escape and the ✕ close it too.
If a kind of content can't be read at that moment, its list says so, for example "The products could not be searched right now.", and the other lists still answer.
What Instant search looks through
Pages. TeleportHQ reads every word on each public page of your site when you publish, so page changes reach the search with your next publish. The words of your navigation and footer don't count, because they're on every page. These pages are never searched:
- pages behind a sign-in or a subscription;
- pages hidden from search engines, and pages that redirect elsewhere;
- your 404 page, and checkout, account, sign-in and admin pages;
- pages made for each post, product or bookable item (those are searched as posts, products and items instead).
Products, blog posts, help articles and bookable items. They're looked up in your data when a visitor searches, by their name or title, description and other details such as tags and category. Only what visitors may see is found, for example published posts, never drafts. A result opens the item's own page, so a kind of content without such a page isn't listed.
Matching ignores capitals and accents in page words: "cafe" finds "Café". A page whose title matches comes before one that only mentions the word.
Check that it worked
On the canvas, your navigation shows the search icon (or field). Publish your site, open it and press Ctrl+K (⌘K on a Mac): the search opens. Type a word from one of your pages, and the page shows under Pages.
Turn Instant search off
- In the left sidebar, click Plugins, then Instant search.
- Click Instant search enabled. The Disable Instant search window says: "This removes the Search component from your project and the search button the plugin added to your navigation; a search element of your own goes back to what it did before. Nothing in your data changes."
- Click Disable Instant search.
Your changes to the Search component go with it. Publish to take the search off your live site.
Troubleshooting
The TeleportHQ Instant search drawer lists problems under Needs attention, each with a button that fixes it:
"No search control in the navigation" The control was removed from your navigation, so visitors have nothing to open the search with. Click Add control.
"The navigation is gone" The search control went with your navigation. Click Add a navigation: TeleportHQ adds a plain navigation and puts the control in it.
"The Search component is missing" The Search component was deleted. Click Add the Search component to build a new one.
"The search does not list products yet" (or another kind) You switched on a feature, such as E-commerce, after the Search component was built. Click Add the lists. The rest of the component stays as it is.
"No place for the search control" Your project now uses the dashboard layout, which has no place for the control. Visitors can still open the search with Ctrl+K (⌘K on a Mac) while Keyboard shortcuts is on. Show setting points you to it.
A page I changed or added isn't found on the live site Page words are read when you publish. Publish again. If the page is hidden from search engines or needs a sign-in, it's never searched.
I changed a setting, but the live search hasn't Settings reach your live site when you publish. Publish again.
The row says "Needs a top navigation" and the switch is greyed out Your project uses the dashboard layout. Instant search puts its control in a top navigation, and that layout has none.
Good to know
- Instant search and a list's own search are different. A search box inside one list, such as the search on your shop page, only filters that list. See How to add search to a list.
- At most 500 pages are searched. A very long page is searched by its first part.
- Code downloads. Instant search is built into the Next.js code of your site.
- Other plugins in the same group. Item comparison lets visitors compare products or bookable items side by side. See How to let visitors compare products or bookable items side by side (Item comparison).