Step 5: (Optional) Search Snippet Generator

To make the process quick and seamless for adding a search bar, you can use the Search snippet generator to the Yext platform that will automatically populate the fields below with the variables from your account. The snippets provided in the Yext platform will include all three steps of initializing the library, placing, and styling the search bar. This is currently only available for the static search bar, and not the overlay option. The platform snippet generator will also provide snippets for creating the search results page using the JS Snippet integration option.

Follow the steps below to use the Search snippet generator.

  1. Navigate to your Yext account > Search > select your experience > Experience Details and select “Integrate Search on Your Site”.

answers snippet generator

  1. Add Search Results: Select the site you want to integrate and the integration type you want to use.

answers snippet generator select

If you select the JS Snippet approach, this will provide a code snippet to add the search experience to your search results page that you can use in the JS Snippet approach of this guide.

answers snippet generator search results code

If you select the Subdomain approach, you will not need a code snippet to create your search results page.

  1. Add Search Bar: Enter the Search Results Page URL - the URL where you will be hosting your search results, or verify the URL indicated.

answers snippet generator results page url

This will provide two code snippets to add the Yext search bar. The Search Bar JS Snippet at the top can be used in Step 1 of the Adding a Search Bar Guide to initialize the library. The second Search Bar Markup code snippet can be used in Step 2 of the Adding a Search Bar Guide to place the search bar.

answers snippet generator search bar code

Feedback