Schema
Comment Schema
On this page
Schema.org Comment
- Type:
defineComment(input?: Comment)
Describes a comment. Usually in the context of an Article or a WebPage.
Useful Links
Required properties
- text
string
Content of the comment
Recommended Properties
- author
Person
The registered author is moved to a root Schema node, resolving the field as reference to a Person.
Defaults
- @type:
Comment - @id:
${canonicalUrl}#/schema/comment/${hash(node)} - about: Article reference
Resolves
authorwill be resolved as root nodes and referenced
Examples
See the blog recipe for more examples.
Minimal
defineComment({
text: 'This is really cool!',
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?: string
/**
* The date and time the comment was last modified.
*/
dateModified?: string
/**
* The number of upvotes the comment has received.
*/
upvoteCount?: number
/**
* The number of downvotes the comment has received.
*/
downvoteCount?: number
}
Related Schemas
Did this page help you?
Breadcrumb Schema
Use defineBreadcrumb() to add BreadcrumbList structured data. Display clickable navigation paths in Google search results for better user experience.
Course Schema
Use defineCourse() to add Course structured data. Enable rich results for educational courses with provider, description, and course details.