docs
SocialMediaPosting
The SocialMediaPosting schema type describes a single update on a social network — a tweet, status update, reply, or shared post. It is the right markup when republishing or embedding social content on your own pages.
About SocialMediaPosting
SocialMediaPosting inherits from Article, so it accepts the same headline, author, and date fields. The distinguishing field is sharedContent — use it when the post quotes, reshares, or replies to another piece of content so search engines can model the conversation graph. Always set url to the canonical permalink on the source platform.
Fields
| Field | Type | Required | Description |
|---|---|---|---|
headline | string | ✓ | Title or first line of the post. |
description | text | — | Full text or summary of the social post. |
image | url | ImageObject | — | An image attached to the post. |
author | url | Person | — | The user who authored the post. |
publisher | string | object | — | The publisher of the post — either a URL string or an Organization object with name and logoUrl. |
datePublished | datetime | — | When the post was published (ISO 8601). |
dateModified | datetime | — | When the post was last modified (ISO 8601). |
sharedContent[].url | url | — | URL of any shared / quoted content. |
sharedContent[].headline | string | — | Headline or title of the shared / quoted content. |
Plugin Registration
sanity.config.ts
import { defineConfig } from 'sanity'
import { schemaOrgSocialMediaPostingPlugin } from 'sanity-plugin-seofields/schema'
export default defineConfig({
plugins: [
schemaOrgSocialMediaPostingPlugin(),
],
})Schema Usage
Add theschemaOrgSocialMediaPosting field to any document schema:
schemas/socialPost.ts
import { defineField, defineType } from 'sanity'
export default defineType({
name: 'socialPost',
title: 'Social Post',
type: 'document',
fields: [
defineField({
name: 'schemaOrgSocialMediaPosting',
title: 'SocialMediaPosting Schema',
type: 'schemaOrgSocialMediaPosting',
}),
],
})GROQ Query
GROQ query
*[_type == "socialPost"][0]{
schemaOrgSocialMediaPosting {
headline,
description,
image,
author,
publisher,
datePublished,
dateModified,
sharedContent[] {
url,
headline
}
}
}Next.js Component
app/posts/[slug]/page.tsx
import { SocialMediaPostingSchema } from 'sanity-plugin-seofields/schema/next'
export default function Page({ data }) {
return <SocialMediaPostingSchema data={data.schemaOrgSocialMediaPosting} />
}JSON-LD Output
Generated JSON-LD
{
"@context": "https://schema.org",
"@type": "SocialMediaPosting",
"headline": "Just shipped a new version of sanity-plugin-seofields",
"description": "Just shipped a new version of sanity-plugin-seofields with 14 new Schema.org types. Huge thanks to everyone who contributed feedback!",
"image": "https://example.com/posts/release.jpg",
"author": {
"@type": "Person",
"name": "Hardik Desai",
"url": "https://thehardik.in"
},
"publisher": {
"@type": "Organization",
"name": "Tech Blog",
"logo": {
"@type": "ImageObject",
"url": "https://example.com/logo.png"
}
},
"datePublished": "2025-03-12T16:24:00Z",
"dateModified": "2025-03-12T17:00:00Z",
"sharedContent": {
"@type": "WebPage",
"url": "https://github.com/hrdtbs/sanity-plugin-seofields/releases/tag/v2.0.0",
"headline": "sanity-plugin-seofields v2.0.0 Release"
}
}Was this page helpful?