How to create Sitelinks Search Box markup?

Modified on Mon, 27 Nov 2023 at 09:09 AM

Google may decide to award your website a SiteLinks Search Box appearance. When you have valid SearchAction markup on your homepage, Google will redirect any queries from the SiteLinks Search Box into your internal site search. This support article demonstrates how to author SiteLinks Search Box (SLSB) markup using the Schema App Editor.



Note: If your site is on Wordpress, the Schema App plugin can automatically generate Sitelinks Search Box markup.


Note: Being awarded SiteLinks Search Box is strictly Google's decision. Adding markup will not make it more likely to be awarded SLSB. Instead, it means that if/when Google does award the SLSB, a query will be directed to your internal site search.


How to create Sitelinks Search Box markup


TABLE OF CONTENTS


Step 1: Create a Website data item for the Home Page

Fill out the name and URL properties for the Website data item. Your WebSite name property should match the name of your website. Use the potentialAction property to create a SearchAction data item.



Step 2: Create a SearchAction data item

The name of your SearchAction data item can be anything. We recommend that you name it something you can easily identify from a list of data items.



Step 3: Identify the URL Template used on your website

The URL template is the URL pattern used for internal site search across your website. 


To find your base URL follow this process:


1. Search for some term on your site. In this example, we're searching for "How To" on https://schemaapp.com


2Copy the URL in your address bar but remove the search term you looked up (e.g How To). In this example, we will copy https://www.schemaapp.com/?s=, leaving out the How+To



Step 4: Define the "target" property by modifying a the base URL from Step 3

Paste what you copied in Step 3 into the target property. Append the URL with a variable wrapped in curly brackets (i.e {search_term_string}). This variable that will be replaced with whatever search term a Google user may enter on the SERP. In our example, the full value for our target property is "https://www.schemaapp.com/?s={search_term_string}".




Note: Per schema.org, the target property does expect an EntryPoint data item. However, you only need to paste text into the target property. Google will automatically transform this value into an EntryPoint data item.


Step 5: Define the "queryInput" using the variable from Step 4.

Use the variable from Step 4 without its curly brackets. Paste "required name =" into the query input property, followed by the variable.


In our example, this would be "required name=search_term_string" 


Note: Per schema.org, the query-input expects a PropertyValueSpecification data item. However, you only need to paste text into the query-input property. Google will automatically transform this value into a PropertyValueSpecification data item.


Step 6: Leave the "query" property blank

If Google uses your Search Action markup in the SERP, the "query" property will reflect whatever a user types in the search bar.


Step 7: Confirm that your Search Action markup is valid by using the Rich Results Test. 

Use the "View JSON-LD" button to view your JSON-LD and test with Google's Rich Results Test.



The finished SearchAction data item should look like this in the Editor:









Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article