v30.0 March 19 ยท 5 months ago ยท Releases
Schema Markup
Structured data markup is a form of SEO that allows websites to have engaging widgets in search results known as rich results
Schemas
Schema Docs โ Schema Search
Schema Docs โ Full schema hierarchy
Google Search Central โ Supported Structured data markup
Formats
| JSON-LD | JSON object in the <head> |
Recommended |
| Microdata | HTML tags in <body> by |
|
| RDFa | HTML tags in <body> by |
Google Search Central โ Structured data ยท Supported formats
JSON-LD
JSON-LD ยท JSON for Linking Data
<script type="application/ld+json"> โPlace a JSON-LD <script> in your <head>
{ "@type": "VideoGame", โThe "@type" is a Schema Markup schema
Schema Docs โ Schema Search
Full schema hierarchy
Example โ 11 collapsed lines
"gamePlatform": "Minecraft: Java Edition", "gameServer": { "@type": "GameServer", โNested objects are specified with "@type"
"playersOnline": 115, }, "playMode": "MultiPlayer", โAlternatlvely, Enumerations can be specified by name
"url": "https://zombiecraft.net", "name": "Zombiecraft", "creator": "Stephcraft", "version": "Alpha" }</script> Microdata
Microdata works with 3 HTML tags
<a itemprop="url" href="https://zombiecraft.net">Website</a> <p> A <span itemprop="gamePlatform">Minecraft: Java Edition</span> server made by <span itemprop="creator">Stephcraft</span>, currently in <span itemprop="version">Alpha</span> Properties can be under sub-elements
</p>Advanced โ 6 collapsed lines
<span itemprop="playersOnline">115</span> Online </div> </div> Schema Docs โ Getting started using Microdata
Wikipedia โ HTML Microdata
RDFa
RDFa works with 3 HTML tags
vocabtypeofproperty
<a property="url" href="https://zombiecraft.net">Website</a> <p> A <span property="gamePlatform">Minecraft: Java Edition</span> server made by <span property="creator">Stephcraft</span>, currently in <span property="version">Alpha</span> Properties can be under sub-elements
</p>Advanced โ 6 collapsed lines
<link property="playMode" href="https://schema.org/MultiPlayer">Play Multiplayer!</link> <div property="gameServer" typeof="GameServer"> Nested Schemas can be identified with both property and typeof
<span property="playersOnline">115</span> Online </div> </div>Generate JSON-LD
JSON-LD is Recommended because it can be generated independently from the siteโs content
schema-dts | 1.2K | 2.7M | 2.0.0 | 7 years | Types |
react-schemaorg | 520 | 142K | 2.0.0 | 7 years | React |
astro-seo-schema | 608 | 18K | 7.0.0 | 4 years | Astro |
import type { VideoGame, CreativeWork, WithContext } from 'schema-dts'2 collapsed lines
import { playersOnline, serverStatus } from '@/realtime' import { url, name, author, version } from '@/consts'
export const schemaMarkup: WithContext<VideoGame> = { '@context': 'https://schema.org', '@type': 'VideoGame',Example โ 9 collapsed lines
'gamePlatform': 'Minecraft: Java Edition', 'gameServer': { "playersOnline": playersOnline, "serverStatus": `https://schema.org/${serverStatus}` }, 'playMode': 'MultiPlayer',
/** @see CreativeWork */ url, name, author, version }<script type="application/ld+json"> {JSON.stringify(schemaMarkup)}</script>Tools
Editors
JSON-LD โ Playground
Schema Markup Generator
Google โ Structured Data Markup Helper
Validators
Schema.org โ Validator
Google โ Rich Results Test
Resources
Schema.org
Google Search Central โ Structured data
Schema Markup Usage Statistics
Frameworks
Astro Docs โ JSON-LD
Next.js Docs โ JSON-LD
TanStack Start Docs โ JSON-LD