Skip to main content
seofields
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

FieldTypeRequiredDescription
headlinestringTitle or first line of the post.
descriptiontextFull text or summary of the social post.
imageurl | ImageObjectAn image attached to the post.
authorurl | PersonThe user who authored the post.
publisherstring | objectThe publisher of the post — either a URL string or an Organization object with name and logoUrl.
datePublisheddatetimeWhen the post was published (ISO 8601).
dateModifieddatetimeWhen the post was last modified (ISO 8601).
sharedContent[].urlurlURL of any shared / quoted content.
sharedContent[].headlinestringHeadline 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?