Generate JSON-LD structured data for a FAQ page in Next.js
Use the JsonLdForFaq component to generate JSON-LD structured data for a FAQ page in Next.js.
Requirements
Before using the file, make sure your project meets the following requirements:
- Next.js 13.0.0 or higher
- Next.js App Router
Props
- Name
faqs- Type
- Array<Object>
- Required
- required
- Description
The list of FAQ entries.
- Name
faqs[].question- Type
- string
- Required
- required
- Description
The question being answered.
- Name
faqs[].answer- Type
- string
- Required
- required
- Description
The corresponding answer to the question.
Usage
Add the file to your project
Copy the JsonLdForFaq.tsx or JsonLdForFaq.jsx file to your project.
Import the JsonLdForFaq component
Import the JsonLdForFaq component into every page where you want to generate the JSON-LD structured data.
src/app/page.tsx
import { JsonLdForFaq } from "@/components/JsonLdForFaq";
export default function Page() {
return (
<JsonLdForFaq
faqs={[
{
question: "What is Nova.js?",
answer: "Nova.js is a collection of dependency-free React hooks.",
},
{
question: "Is Nova.js free?",
answer: "Yes, it's completely free and open-source.",
},
]}
/>
);
}