Skip to main content
seofields
docs

Course Schema

Add Course structured data to your Sanity documents to enable educational content to appear in Google's course rich results.

About Course Schema

Course schema enables educational content to appear in Google's course rich results. When properly implemented, Google can display course details such as the provider, description, and ratings directly in search results, helping learners discover your educational offerings more easily.

Fields

FieldTypeRequiredDescription
namestringThe title of the course.
courseCodestringAn alphanumeric code that uniquely identifies the course.
descriptionstringA description of the course content and objectives.
ownerstring | objectThe person or organization that owns/offers this course — a URL string or a Person/Organization object.
provider.namestringThe name of the organization or institution offering the course.
provider.sameAsstringA URL identifying the course provider (e.g. their website).

Plugin Registration

sanity.config.ts
import { defineConfig } from "sanity";
import { seoFields } from "sanity-plugin-seofields";
import { schemaOrgCoursePlugin } from "sanity-plugin-seofields/schema";

export default defineConfig({
  // ...your sanity config
  plugins: [
    seoFields(),
    schemaOrgCoursePlugin(),
  ],
});

Schema Usage

Add the schemaOrgCourse 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: 'schemaOrgCourse',
      title: 'Course Schema',
      type: 'schemaOrgCourse',
    }),
  ],
})

GROQ Query

GROQ query
*[_type == "yourDocument"][0]{
  schemaOrgCourse {
    name,
    courseCode,
    description,
    owner,
    provider {
      name,
      sameAs
    }
  }
}

Next.js Component

app/page.tsx
import { CourseSchema } from "sanity-plugin-seofields/schema/next";

export default function Page({ data }) {
  return (
    <>
      <CourseSchema data={data.schemaOrgCourse} />
      {/* Your page content */}
    </>
  );
}

JSON-LD Output

Generated JSON-LD
{
  "@context": "https://schema.org",
  "@type": "Course",
  "name": "Introduction to Web Development",
  "courseCode": "WEB101",
  "description": "A comprehensive introduction to HTML, CSS, and JavaScript for beginners.",
  "owner": {
    "@type": "Organization",
    "name": "Open Learning Institute"
  },
  "provider": {
    "@type": "Organization",
    "name": "Code Academy",
    "sameAs": "https://codeacademy.com"
  }
}

Last updated: May 27, 2026. Tested with: Sanity Studio v3, v4, and v5.

Was this page helpful?