CategoryCode
CategoryCode is a DefinedTerm subtype for a single code in a structured classification scheme: an ICD-10 medical diagnosis code, a NAICS industry code, a school curriculum code, a company's internal SKU category. It adds 2 direct properties: codeValue (the short textual code, e.g. "J18.9") and inCodeSet (the CategoryCodeSet this code belongs to).
CategoryCode is the canonical way to attach coded classifications to anything. Use it inside Product's category, MedicalEntity's code, JobPosting's occupationalCategory, and Course's educationalLevel.
Full example of schema.org/CategoryCode json-ld markup
The markup is verified as valid with Rich Results Test from Google.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "CategoryCode",
"name": "Error",
"codeValue": "ERR",
"description": "Violates the schema.org or Google rich-result contract; likely to prevent rich-result eligibility.",
"inCodeSet": {
"@type": "CategoryCodeSet",
"name": "Xoo Code Severity Taxonomy",
"url": "https://xoocode.com/taxonomies/severity"
},
"url": "https://xoocode.com/taxonomies/severity/err"
}
</script>Minimal valid version
The smallest markup that still produces a valid CategoryCode entity. Use it as the floor. Reach for the advanced example above when you want search engines and AI agents to understand more about your content.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "CategoryCode",
"name": "Error",
"codeValue": "ERR",
"inCodeSet": { "@type": "CategoryCodeSet", "name": "Xoo Code Severity Taxonomy" }
}
</script>Google rich results this unlocks
Markup matching this example makes your page eligible for the following Google Search rich results. The primary target drives the required / recommended property classification in the advanced code block above.
- Google docsNo dedicated rich result (used by AI knowledge graphs and coded search indexers)
Common CategoryCode mistakes
Mistakes that pass validation but silently fail to earn rich results or mislead consumers walking the graph. Avoid these and your markup will be ahead of most sites in the wild.
- 01
codeValue with trailing or leading punctuation
Wrong"codeValue": "J18.9."Right"codeValue": "J18.9" (exactly as the scheme specifies)codeValue must match the scheme's canonical form. Extra punctuation breaks joins with external registries (ICD-10, NAICS, etc.).
- 02
Using CategoryCode where DefinedTerm suffices
WrongCategoryCode with no codeValue and no inCodeSetRightDefinedTerm for uncoded taxonomy members; CategoryCode only when a short textual code uniquely identifies the valueCategoryCode is the coded subtype; without codeValue or inCodeSet, you are just using it as a heavier DefinedTerm for no gain.
Schema properties in this example
About the example data
The "ERR" code in the Xoo Code Severity Taxonomy, meaning "violates the schema.org or Google rich-result contract".
Comments
Loading comments...