---
title: "Course Schema"
description: "Add Course structured data to your Sanity documents. Enable educational content to appear in Google's course rich results with schema.org markup."
canonical: https://sanity-plugin-seofields.thehardik.in/docs/schema-org/course
---

# Course Schema

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

## About Course Schema

Course schema enables educational content to appear in Google&apos;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

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | Yes | The title of the course. |
| `courseCode` | string | No | An alphanumeric code that uniquely identifies the course. |
| `description` | string | No | A description of the course content and objectives. |
| `owner` | string \| object | No | The person or organization that owns/offers this course — a URL string or a Person/Organization object. |
| `provider.name` | string | No | The name of the organization or institution offering the course. |
| `provider.sameAs` | string | No | A URL identifying the course provider (e.g. their website). |

## Plugin Registration

```typescript
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:

```typescript
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

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

## Next.js Component

```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

```json
{
  "@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"
  }
}
```
