WhatsApp

A Frequently Asked Question (FAQ) page contains a list of questions and answers pertaining to a particular topic. FAQ pages can have a rich result on Search and an Action on the Google Assistant. The feature is available on desktop and mobile devices.

If your page has a single question and users can submit alternative answers, use QAPage instead. FAQ Structured data can be used for:

  • An FAQ page written by the site itself, with no way for users to submit alternative answers.
  • A product support page that lists FAQs, with no way for users to submit alternative answers.

For example,

<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [{
"@type": "Question",
"name": "What is the return policy?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Most unopened items in new condition and returned within <strong>90 days</strong> will receive a refund or exchange.
Some items have a modified return policy noted on the receipt or packing slip. <a href=http://example.com/returns> Click here </a> to initiate a return.</p>"
}
}, {
"@type": "Question",
"name": "How long does it take to process a refund?",
"acceptedAnswer": {
"@type": "Answer",
"text": "We will reimburse you for returned items in the same way you paid for them.
For example, any amounts deducted from a gift card will be credited back to a gift card."
}
}, {
"@type": "Question",
"name": "When will my credit card be charged?",
"acceptedAnswer": {
"@type": "Answer",
"text": "We'll attempt to securely charge your credit card at the point of purchase online.
If there's a problem, you'll be notified on the spot and prompted to use another card."}
}
}]
}
</script>

The FAQPage type indicates that the page is an FAQ with answered questions. There must be one FAQPage type definition per page.

Required Properties

mainEntity (Question): An array of Question elements which comprise the list of answered questions that this FAQPage is about. The Question type defines a single answered question within the FAQ. Every Question instance must be contained within the mainEntity property array.

Question

  • acceptedAnswer (Answer): The answer to the question. There must be one answer per question.
  • name (Text): The full text of the question.

Answer

text (Text): The full answer to the question. The answer may contain HTML content such as links and lists.

FAQPage Schema using PHP

Step 1: Create JSON Array

$json = array(
'@context' => "https://schema.org",
'@type' => "FAQPage",
'mainEntity' => array()
);

Step 2: Create mainEntity Array

Suppose PHP array $items contain questions and answers.

foreach($items as $item)
{
$questions = array(
'@type' => 'Question',
'name' => $item[0],
'acceptedAnswer' => array(
'@type' => "Answer",
'text' => $item[1]
)
);

array_push($json['mainEntity'], $questions);
}

Step 3: Create Schema

$schema = '<script type="application/ld+json">';
$schema .= json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
$schema .= '</script>';

echo $schema;

You can test your URL using Google Structured Data Testing tool before publishing your web page.

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive