Schema.org for Site Search
If your site offers a search function, you may like to define markup to help Google understand it.
Useful Links
Define a Search Action
To provide a search action for your WebSite, you need to insert a SearchAction in potentialAction
.
To make configuring this easier, the function defineSearchAction
is provided.
Make sure that you set place {search_term_string}
somewhere in your URL.
This represents a query a user would be searching for.
This markup should go in your root Schema definition.
Composition API
useSchemaOrg([ defineWebSite({ potentialAction: [ defineSearchAction({ target: '/search?q={search_term_string}' }) ] })])
Define your Search Results Page
Using your WebPage Schema, you can define the page as a search results page.
Composition API
useSchemaOrg([ defineWebPage({ '@type': ['CollectionPage', 'SearchResultsPage'], })])
Table of Contents