---
title: "Comment Schema · Unhead"
canonical_url: "https://unhead.unjs.io/docs/typescript/schema-org/api/schema/comment"
last_updated: "2026-09-13T19:31:11.371Z"
meta:
  description: "Use defineComment() to add Comment structured data. Connect user comments to articles and blog posts with author and date information."
  "og:description": "Use defineComment() to add Comment structured data. Connect user comments to articles and blog posts with author and date information."
  "og:title": "Comment Schema · Unhead"
---

Home

`
Unhead on GitHub

Switch to TypeScriptSwitch to VueSwitch to ReactSwitch to SvelteSwitch to Solid.jsSwitch to AngularSwitch to Nuxt

**Schema**

# **Comment Schema**

[Copy for LLMs](https://raw.githubusercontent.com/unjs/unhead/refs/heads/main/docs/schema-org/5.api/9.schema/comment.md)

## Schema.org Comment

- **Type**: `defineComment<T extends Record<string, any>>(input?: Comment & T)`  
  Describes a comment, usually in the context of an Article or WebPage.

## Useful Links

- [**~~Comment - Schema.org~~**](https://schema.org/Comment)
- [**~~Recipe: Blog~~**](https://unhead.unjs.io/docs/schema-org/guides/recipes/blog)

## Required properties

- **text** `**string**`  
  Content of the comment.
- **author** `**Person**`  
  The registered author is moved to a root Schema node, resolving the field as an `**@id**` reference to a [**~~Person~~**](https://unhead.unjs.io/docs/schema-org/api/schema/person).

## Defaults

- **@type**: `**Comment**`
- **@id**: `**${canonicalUrl}#/schema/comment/{n}**`
- **about**: Article reference

## Resolves

- `**author**` is resolved as a root Person node and replaced with an ID reference
- `**dateCreated**` and `**dateModified**` accept Date objects and are serialized as ISO 8601 strings

## Examples

See the [**~~blog~~**](https://unhead.unjs.io/docs/schema-org/guides/recipes/blog) recipe for more examples.

### Minimal

```
defineComment({
  text: 'The setup guide answered my question.',
  author: {
    name: 'Harlan Wilton',
    url: 'https://harlanzw.com',
  }
})
```

## Types

```
export interface CommentSimple extends Thing {
  /**
   * The textual content of the comment, stripping HTML tags.
   */
  text: string
  /**
   *  A reference by ID to the parent Article (or WebPage, when no Article is present).
   */
  about?: IdReference
  /**
   * A reference by ID to the Person who wrote the comment.
   */
  author: NodeRelation<Person>
  /**
   * The date and time the comment was created.
   */
  dateCreated?: ResolvableDate
  /**
   * The date and time the comment was last modified.
   */
  dateModified?: ResolvableDate
  /**
   * The number of upvotes the comment has received.
   */
  upvoteCount?: number
  /**
   * The number of downvotes the comment has received.
   */
  downvoteCount?: number
}
```

## Related Schemas

- [**~~Person~~**](https://unhead.unjs.io/docs/schema-org/api/schema/person): Comment author
- [**~~Article~~**](https://unhead.unjs.io/docs/schema-org/api/schema/article): Commented content

[Edit this page](https://github.com/unjs/unhead/edit/main/docs/schema-org/5.api/9.schema/comment.md)

[Markdown For LLMs](https://raw.githubusercontent.com/unjs/unhead/refs/heads/main/docs/schema-org/5.api/9.schema/comment.md)

**Did this page help you? **

[**Breadcrumb Schema** Use defineBreadcrumb() to add BreadcrumbList structured data that describes a page's position in the site hierarchy.](https://unhead.unjs.io/docs/schema-org/api/schema/breadcrumb) [**Course Schema** Use defineCourse() to add Course structured data with a provider, description, and course details.](https://unhead.unjs.io/docs/schema-org/api/schema/course)

**On this page **

- [Schema.org Comment](#schemaorg-comment)
- [Useful Links](#useful-links)
- [Required properties](#required-properties)
- [Defaults](#defaults)
- [Resolves](#resolves)
- [Examples](#examples)
- [Types](#types)
- [Related Schemas](#related-schemas)