XooCode(){

WebSite

WebSite describes the site itself, not any individual page. Its main purpose in structured data is the potentialAction with a SearchAction, which tells Google "this site has an internal search engine at this URL." Google reads that to display a sitelinks search box directly in the SERP for branded queries ("xoocode" or "xoo code"). Users can type a search query right in Google and get sent to your site's search results page.

WebSite markup goes on the homepage only. It should appear once per site, not on every page. The block identifies the site by url and connects it to the publisher (typically your Organization). Everything else is optional.

Full example of schema.org/WebSite json-ld markup

The markup is verified as valid with Rich Results Test from Google.

Highlight legend:Required by GoogleRecommendedOptional
schema.org/WebSite
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@id": "https://xoocode.com#website",
  "@type": "WebSite",
  "name": "XooCode",
  "alternateName": "Xoo Code",
  "url": "https://xoocode.com",
  "description": "Structured data tools, JSON-LD examples, and schema markup validators for developers and SEO professionals.",
  "inLanguage": "en-US",
  "publisher": {
    "@id": "https://xoocode.com#organization"
  },
  "potentialAction": {
    "@type": "SearchAction",
    "target": {
      "@type": "EntryPoint",
      "urlTemplate": "https://xoocode.com/search?q={search_term_string}"
    },
    "query-input": "required name=search_term_string"
  }
}
</script>

SearchAction and the sitelinks search box

The potentialAction contains a SearchAction with a target URL template and a query-input parameter. The URL template uses {search_term_string} as a placeholder that Google replaces with the user's query. The query-input property tells Google the name of the placeholder. This pattern is rigid: Google only recognizes this exact format, and the placeholder must appear in the URL template exactly as specified.

WebSite vs WebPage

WebPage describes a single page. WebSite describes the entire site. They serve different purposes and can coexist on the same page. The homepage might have both a WebSite block (for the sitelinks search box) and a WebPage block (for the page-level metadata). Other pages should only have WebPage. Google does not expect WebSite on subpages.

publisher on WebSite

The publisher property connects the site to its owning Organization or Person. If your Organization is already marked up elsewhere, reference it via @id. This strengthens the connection between your site and your organization in the knowledge graph. Google uses this relationship for sitelinks, knowledge panels, and entity disambiguation.

Multiple search endpoints

If your site has multiple search scopes (site-wide search plus a product search or documentation search), you can include multiple SearchAction entries in a potentialAction array. Each needs a distinct URL template and target. Google will display the primary search box and may use the others for specialized queries. In practice, one SearchAction is sufficient for most sites.

Minimal valid version

The smallest markup that still produces a valid WebSite entity. Use it as the floor. Reach for the advanced example above when you want search engines and AI agents to understand more about your content.

schema.org/WebSite (minimal)
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "url": "https://xoocode.com",
  "potentialAction": {
    "@type": "SearchAction",
    "target": {
      "@type": "EntryPoint",
      "urlTemplate": "https://xoocode.com/search?q={search_term_string}"
    },
    "query-input": "required name=search_term_string"
  }
}
</script>

Google rich results this unlocks

Markup matching this example makes your page eligible for the following Google Search rich results. The primary target drives the required / recommended property classification in the advanced code block above.

Common WebSite mistakes

Mistakes that pass validation but silently fail to earn rich results or mislead consumers walking the graph. Avoid these and your markup will be ahead of most sites in the wild.

  1. 01

    WebSite markup on every page

    Wrong
    WebSite JSON-LD block on product pages, blog posts, and subpages
    Right
    WebSite block on the homepage only; use WebPage on subpages

    WebSite describes the site, not a page. Placing it on every page creates redundant blocks and can confuse crawlers. Put WebSite on the homepage once. Subpages should use WebPage for page-level metadata.

  2. 02

    SearchAction target without the placeholder

    Wrong
    "urlTemplate": "https://xoocode.com/search"
    Right
    "urlTemplate": "https://xoocode.com/search?q={search_term_string}"

    The URL template must contain the {search_term_string} placeholder. Without it, Google cannot inject the user's query into the URL and the sitelinks search box will not appear. The placeholder name must match the query-input value exactly.

  3. 03

    query-input with wrong format

    Wrong
    "query-input": "search_term_string"
    Right
    "query-input": "required name=search_term_string"

    The query-input value must follow the format "required name=search_term_string". The "required" keyword tells Google the parameter is mandatory. The "name=" prefix maps the placeholder to the template variable. Omitting either part causes Google to ignore the SearchAction.

  4. 04

    Missing publisher connection

    Wrong
    WebSite with url and SearchAction but no publisher
    Right
    "publisher": { "@id": "https://xoocode.com#organization" }

    publisher connects the site to its owning Organization in the knowledge graph. Without it, Google has to infer the relationship from other signals. An explicit @id reference strengthens entity disambiguation and can improve sitelinks and knowledge panel display.

  5. 05

    Confusing WebSite with Organization

    Wrong
    Using WebSite as the main entity when Organization is more appropriate
    Right
    WebSite for the site entity (with SearchAction); Organization for the company entity

    WebSite and Organization serve different purposes. WebSite describes the website and enables the sitelinks search box. Organization describes the company and feeds the knowledge panel. Most homepages should have both, with the Organization referenced as the WebSite's publisher.

About the example data

The example is the xoocode.com homepage, using Xoo Code Inc. as the publisher. The SearchAction points to a /search?q= endpoint. This is the canonical way to tell Google about your site's internal search, and it only needs to appear on the homepage.

Comments

Loading comments...

Leave a comment