Index of every page on this site: llms.txt
TypeScript
Recipes

Site Search

If your site offers a search function, you can describe it with a SearchAction on the WebSite node. Google removed the sitelinks search box in November 2024, so this markup no longer creates that visual feature or affects Google rankings.

Define a Search Action

Add defineSearchAction() to the primary WebSite node's potentialAction. Its URL template must contain {search_term_string}, which is replaced with the visitor's query.

import { defineSearchAction, defineWebSite, useSchemaOrg } from '@unhead/schema-org'

useSchemaOrg(unheadInstance, [
  defineWebSite({
    potentialAction: [
      defineSearchAction({
        target: '/search?q={search_term_string}'
      })
    ]
  })
])

Define your Search Results Page

Set the WebPage type to SearchResultsPage for the search results route.

import { defineWebPage, useSchemaOrg } from '@unhead/schema-org'

useSchemaOrg(unheadInstance, [
  defineWebPage({
    '@type': ['CollectionPage', 'SearchResultsPage'],
  })
])
Did this page help you?