Schema
Question Schema
On this page
Schema.org Question
- Type:
defineQuestion(input?: Question)
Describes an individual question. Most commonly used for creating an FAQ type page.
Useful Links
Required properties
- name
string
The text content of the question. - acceptedAnswer
string|Answer
The text content of the answer.
Examples
Minimal
defineQuestion({
name: 'What is the meaning of life?',
acceptedAnswer: '42',
})
Defaults
- @type:
Question - @id:
${canonicalUrl}#/schema/question/${questionId} - inLanguage:
options.defaultLanguage(see: user Config)
Resolves
See Global Resolves for full context.
- will convert a string answer to an Answer object.
@idis resolved using a hash of the question name if not provided
Relation Transforms
- Each question will append an entry on to
mainEntity
Types
/**
* A specific question - e.g. from a user seeking answers online, or collected in a Frequently Asked Questions (FAQ) document.
*/
export interface QuestionSimple extends Thing {
/**
* The text content of the question.
*/
name: string
/**
* An answer object, with a text property which contains the answer to the question.
*/
acceptedAnswer: NodeRelation<Answer | string>
/**
* The language code for the question; e.g., en-GB.
*/
inLanguage?: string
/**
* The number of answers provided for this question.
*/
answerCount?: number
/**
* The date and time the question was created.
*/
dateCreated?: string
/**
* Alias for `name`
*/
question?: string
/**
* Alias for `acceptedAnswer`
*/
answer?: string
}
/**
* An answer offered to a question; perhaps correct, perhaps opinionated or wrong.
*/
export interface Answer extends Optional<Thing, '@id'> {
text: string
}
Related Schemas
Did this page help you?
Product Schema
Use defineProduct() to add Product structured data for e-commerce. Enable rich snippets with pricing, reviews, and availability in Google search results.
Recipe Schema
Use defineRecipe() to add Recipe structured data. Enable rich snippets with cooking time, ingredients, nutrition, and step-by-step instructions in search.