docs
WebSite
The WebSite schema type represents an entire website. It enables search engines to display the site name, sitelinks search box, and publisher information directly in search results.
About WebSite
The WebSite schema is one of the most important structured data types for SEO. It tells search engines the official name of your site, its primary URL, and the organization behind it. Google uses this data to power the site name feature in search results and may display a sitelinks search box for eligible sites. Adding this schema is recommended for every website as a foundational piece of structured data.
Fields
| Field | Type | Required | Description |
|---|---|---|---|
name | string | ✓ | The name of the website displayed in search results and knowledge panels. |
url | string | ✓ | The canonical URL of the website (e.g. https://example.com). |
description | string | — | A short description of the website and its purpose. |
inLanguage | string | — | The primary language of the website content (e.g. en, es, fr). |
publisher.name | string | — | The name of the organization or person that publishes the website. |
publisher.url | string | — | The URL of the publishing organization or person. |
publisher.logoUrl | string | — | URL of the publisher's logo image for search result branding. |
Plugin Registration
sanity.config.ts
import { defineConfig } from 'sanity'
import { schemaOrgWebsitePlugin } from 'sanity-plugin-seofields/schema'
export default defineConfig({
// ... your sanity config
plugins: [
schemaOrgWebsitePlugin(),
],
})Schema Usage
Add theschemaOrgWebsite field to any document schema:
schemas/page.ts
import { defineField, defineType } from 'sanity'
export default defineType({
name: 'page',
title: 'Page',
type: 'document',
fields: [
// ... your other fields
defineField({
name: 'schemaOrgWebsite',
title: 'Website Schema',
type: 'schemaOrgWebsite',
}),
],
})GROQ Query
GROQ query
*[_type == "yourDocument"][0]{
schemaOrgWebsite {
name,
url,
description,
inLanguage,
publisher {
name,
url,
logoUrl
}
}
}Next.js Component
app/layout.tsx
import { WebsiteSchema } from 'sanity-plugin-seofields/schema/next'
export default function Layout({ data }) {
return <WebsiteSchema data={data.schemaOrgWebsite} />
}JSON-LD Output
Generated JSON-LD
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "My Site",
"url": "https://example.com",
"description": "A website about web development and design",
"inLanguage": "en",
"publisher": {
"@type": "Organization",
"name": "My Company",
"url": "https://example.com",
"logo": {
"@type": "ImageObject",
"url": "https://example.com/logo.png"
}
}
}Was this page helpful?