From ae2a2b69b057aa52bf8c0a477a9bc097819783fa Mon Sep 17 00:00:00 2001 From: Ifiok Jr Date: Thu, 9 Jan 2020 12:23:47 +0000 Subject: [PATCH] fixup! feat(FAQJsonLd): add new json ld component for FAQ pages --- README.md | 14 ++++++++++++++ src/jsonld/__tests__/jsonld.test.tsx | 2 +- src/jsonld/faq.tsx | 11 ++++++++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 232036e..c5d8d3c 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ This codebase was initially forked from the brilliant [next-seo](https://github. - [Book](#book) - [Speakable](#speakable) - [FAQ](#faq) + - [Question Interface](#question-interface) - [Course](#course) - [Corporate Contact (Deprecated)](#corporate-contact-deprecated) - [Local Business](#local-business) @@ -928,6 +929,19 @@ export default () => ( ); ``` +| Property | Type | Description | +| -------------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------- | +| [questions](#question-interface) | Question[] | An array of Question elements which comprise the list of answered questions that this FAQPage is about. | + +#### Question Interface + +The questions and answers for an FAQ Page. + +| Property | Type | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------- | ----------------------------------------------------------------------------------------- | +| [answer](https://github.com/ifiokjr/gatsby-plugin-next-seo/blob/master/docs/api/gatsby-plugin-next-seo.question.answer.md) | string | The answer to the question. There must be one answer per question. | +| [question](https://github.com/ifiokjr/gatsby-plugin-next-seo/blob/master/docs/api/gatsby-plugin-next-seo.question.question.md) | string | The full text of the question. For example, "How long does it take to process a refund?". | + ### Course ```tsx diff --git a/src/jsonld/__tests__/jsonld.test.tsx b/src/jsonld/__tests__/jsonld.test.tsx index 37ef5b3..6097b39 100644 --- a/src/jsonld/__tests__/jsonld.test.tsx +++ b/src/jsonld/__tests__/jsonld.test.tsx @@ -308,7 +308,7 @@ test('ProductJsonLd', () => { test('FAQJsonLd', () => { render( { * An array of Question elements which comprise the list of answered questions * that this FAQPage is about. */ - mainEntity: Question[]; + questions: Question[]; } -interface Question { +/** + * The questions and answers for an FAQ Page. + * + * @public + */ +export interface Question { /** * The full text of the question. For example, "How long does it take to * process a refund?". @@ -78,7 +83,7 @@ const transformMainEntity = (questions: Question[]): SchemaQuestion[] => * * @public */ -export const FAQJsonLd: FC = ({ mainEntity, overrides = {}, defer = false }) => { +export const FAQJsonLd: FC = ({ questions: mainEntity, overrides = {}, defer = false }) => { const json: WithContext = { '@context': 'https://schema.org', '@type': 'FAQPage',