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.
Navigate to your Yext account > Search > select your experience > Experience Details and select “Integrate Search on Your Site”.
Add Search Results: Select the site you want to integrate and the integration type you want to use.
If you select the Subdomain approach, you will not need a code snippet to create your search results page.
Add Search Bar: Enter the Search Results Page URL - the URL where you will be hosting your search results, or verify the URL indicated.
This will provide two code snippets to add the Yext search bar. The Search Bar JS Snippet at the top can be used in to initialize the library. The second Search Bar Markup code snippet can be used in to place the search bar.