Sitelinks Search Box Schema Framework

Use conditional-logic schema generation to keep Sitelinks Search Box markup aligned with real page state and avoid stale or invalid static templates.

  • Google no longer shows the sitelinks search box: the farewell was announced Oct 21, 2024 and the box stopped appearing in Search on Nov 21, 2024. The nositelinkssearchbox rule was archived on Nov 29, 2024.
  • Leftover WebSite plus SearchAction markup causes no errors, and SearchAction keeps its schema.org meaning, describing your site search for AI assistants and other consumers.
  • Build WebSite markup for site names instead: name and url on the home page, plus alternateName. Add SearchAction only when the site has a working search URL.

When To Use It

Google Search Central RetiredDocumentation changelog

The documentation page was removed on Nov 29, 2024. The live use of WebSite markup is now site name structured data on the home page, which the framework below builds, with an optional SearchAction kept for other consumers.

Key Implementation Documentation Highlights

  • Google lists no required properties for the sitelinks search box, because the feature is retired.
  • Site name markup, the replacement use of WebSite, requires name (the site name: unique, accurate, concise, commonly recognized, without suffixes such as Inc) and url (the canonical home page of the domain or subdomain).
  • Site name recommends alternateName, listed in order of preference, for example a recognized acronym or shorter name.
  • Put the WebSite markup on the home page at the domain or subdomain root; subdirectory home pages are not supported. Use the same name in og:site_name, the title, headings and Organization markup.
  • Optional potentialAction: a SearchAction whose target urlTemplate contains {search_term_string} and whose query-input is required name=search_term_string. It earns no Google feature.

Rules the framework enforces before it emits markup:

  • url must be the root of the domain or subdomain; any path, query, or fragment suppresses the markup.
  • The home page must be indexable and self-canonical.
  • A missing name, or one ending in a legal suffix such as Inc or LLC, suppresses the markup.
  • SearchAction is added only when site search exists and the URL template is absolute and contains {search_term_string}.

Template Approach

const pageData = {
  siteName: "Example Outfitters",
  homeUrl: "https://www.example.com/",
  searchTemplate: "https://www.example.com/search?q={search_term_string}"
};

const staticTemplate = {
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": pageData.siteName,
  "url": pageData.homeUrl,
  "potentialAction": {
    "@type": "SearchAction",
    "target": { "@type": "EntryPoint", "urlTemplate": pageData.searchTemplate },
    "query-input": "required name=search_term_string"
  }
};

Conditional-logic Framework

function isAbsoluteUrl(value) {
  if (typeof value !== "string") return false;
  try {
    const url = new URL(value);
    return url.protocol === "https:" || url.protocol === "http:";
  } catch {
    return false;
  }
}

function isRootUrl(value) {
  // site name markup works at domain or subdomain level only, never a subdirectory
  if (!isAbsoluteUrl(value)) return false;
  const url = new URL(value);
  return url.pathname === "/" && !url.search && !url.hash;
}

function compact(value) {
  if (Array.isArray(value)) {
    const items = value.map(compact).filter((item) => item !== undefined);
    return items.length ? items : undefined;
  }
  if (value && typeof value === "object") {
    const out = {};
    for (const [key, item] of Object.entries(value)) {
      const kept = compact(item);
      if (kept !== undefined) out[key] = kept;
    }
    return Object.keys(out).length ? out : undefined;
  }
  if (value === null || value === undefined || value === "") return undefined;
  return value;
}

const LEGAL_SUFFIX = /,?\s+(inc|llc|ltd|gmbh|corp)\.?$/i;

function buildSearchAction(template) {
  // optional and earns no Google feature since Nov 2024; keep only if real site search exists
  if (!isAbsoluteUrl(template) || !template.includes("{search_term_string}")) return null;
  return {
    "@type": "SearchAction",
    "target": { "@type": "EntryPoint", "urlTemplate": template },
    "query-input": "required name=search_term_string"
  };
}

function buildWebSiteSchema(source) {
  // home page gates: indexable, self-canonical, root of the domain or subdomain
  if (source.indexable === false) return null;
  if (!isRootUrl(source.url)) return null;
  if (source.canonicalUrl && source.canonicalUrl !== source.url) return null;

  // site name: required, concise, no legal suffix, same as og:site_name and the title
  const name = (source.siteName || "").trim();
  if (!name || LEGAL_SUFFIX.test(name)) return null;

  const schema = {
    "@context": "https://schema.org",
    "@type": "WebSite",
    "name": name,
    "alternateName": (source.alternateNames || []).filter((n) => n && n !== name), // order of preference
    "url": source.url,
    "potentialAction": source.hasSiteSearch ? buildSearchAction(source.searchUrlTemplate) : null
  };

  return compact(schema);
}

// Usage:
// buildWebSiteSchema({
//   url: "https://www.example.com/",
//   canonicalUrl: "https://www.example.com/",
//   indexable: true,
//   siteName: "Example Outfitters",
//   alternateNames: ["EO", "Example Outfitters Store"],
//   hasSiteSearch: true,
//   searchUrlTemplate: "https://www.example.com/search?q={search_term_string}"
// });

The Output As An Entity Graph

The conditional-logic output above, parsed in your browser and drawn as the graph a crawler builds from it. Every nested object is a node and the property that holds it is the edge. Tap a node to inspect its properties, or drag to rearrange.

Why Conditional Logic Is Better Than Static Templates

  • Moves WebSite markup to its live purpose, site names, without breaking existing SearchAction consumers.
  • Enforces the root-URL rule in code, so the block never ships on subdirectory home pages where site names are not supported.
  • Reads the site name from the same setting that fills og:site_name and the title, keeping every name source consistent.
  • Drops SearchAction automatically when site search is removed, instead of advertising a dead endpoint.

Property Reference

Google retired the Sitelinks Search Box rich result, so its documentation no longer lists required or recommended properties. The framework above is still valid schema.org markup and still describes the page to search engines and AI assistants.

Schema.org types used

Explore Other Schema Framework Pages

Software App (Beta) Use for software product pages that describe platform support and application category clearly. SoftwareApplication Open Limited Speakable Use for news-style pages where specific text segments are appropriate for text-to-speech playback. SpeakableSpecification Open Subscription and Paywalled Content Use for pages with restricted sections so Google can distinguish free previews from protected content. CreativeWork Open Limited Vacation Rental Use for rental property detail pages where booking-relevant amenities and location signals are explicit. VacationRental Open Retired Vehicle Listing Use for inventory pages selling vehicles with standardized listing fields and offer information. Car Open Video Use for pages where a primary video is embedded and key media metadata is visible on-page. VideoObject Open Article Use for editorial pages where the visible content is a complete article with a clear byline and publication timestamps. Article Open Limited Book Actions Use when your page helps users read, preview, or purchase books through clearly described actions. Book Open Breadcrumb Use on pages that belong to a clear hierarchy and display navigational trail links users can follow. BreadcrumbList Open Carousel Use when a page lists multiple related entities in a scannable sequence that can be surfaced as cards. ItemList Open Course Use for educational offerings where curriculum details, provider identity, and delivery context are explicit. Course Open Dataset Use for dataset landing pages so datasets are discoverable in Google Dataset Search with license, creator and download details. Dataset Open Discussion Forum Use for forum and community threads where a primary post and subsequent replies are publicly visible. DiscussionForumPosting Open Limited Education Q&A Use for educational question-answer pages where a single canonical answer and supporting context are visible. Quiz Open Employer Aggregate Rating Use on pages that publish employer rating aggregates from a clear and policy-compliant review source. EmployerAggregateRating Open Retired Estimated Salary Use for compensation insight pages that present transparent salary ranges for specific occupations and locations. Occupation Open Event Use for upcoming events with a real-world or virtual occurrence, schedule, and location context. Event Open Retired Fact Check Use for fact-checking pages that evaluate a specific claim with a transparent rating methodology. ClaimReview Open Retired Home Activities Use for virtual classes and activities where participation details and timing are clearly listed. Event Open Retired How-To Use for instructional content that teaches a process through ordered steps and actionable detail. HowTo Open Image Metadata Use on image pages and image hosts that expose ownership and licensing information to search engines. ImageObject Open Job Posting Use for active job listings that include role details, hiring entity, and location/salary context. JobPosting Open Retired Learning Video Use for educational videos where the learning objective and pedagogical structure are explicit. LearningResource Open Local Business Use for physical businesses serving local customers with publicly verifiable contact and location details. LocalBusiness Open Loyalty Program Use to publish a loyalty program and its tiers once at the organization level, so member prices and member shipping can reference them. MemberProgram Open Math Solvers Use for pages that solve mathematical expressions and present step-by-step computational guidance. MathSolver Open Merchant Listing Use on pages where a product can be bought, with price, availability, shipping and return details. Product Open Limited Movie Use for movie detail pages with canonical film information and transparent metadata attribution. Movie Open Organization Use for official organization pages to clarify brand identity and authoritative entity signals. Organization Open Retired Practice Problems Use for educational practice content that presents solvable problems and answer validation structure. Quiz Open Product Snippet Use for product pages where pricing, availability, and product identity are visible to users. Product Open Product Variants Use when one product comes in variants such as size or color, grouped with ProductGroup. ProductGroup Open Profile Page Use for creator or contributor profile pages where identity attributes and ownership are explicit. ProfilePage Open Q&A Use for pages where users submit questions and community or editorial answers are displayed. QAPage Open Recipe Use for recipe pages with complete ingredients, instructions, and preparation details. Recipe Open Return Policy Use to publish a merchant return policy once at the organization level, with offer-level overrides. MerchantReturnPolicy Open Review Snippet Use when a page publishes genuine reviews tied to a clearly identified product, service, or entity. Review Open Shipping Policy Use to publish shipping rates, delivery times and destinations once at the organization level. ShippingService Open Site Name Use on the home page so Google shows the preferred site name in search results. WebSite Open

Implement Sitelinks Search Box Schema Frameworks Correctly

Get implementation support for conditional schema architecture, validation, and deployment governance.