Skip to main content

Command Palette

Search for a command to run...

How to Add Structured Data to Next.js Pages

impeccify.com

Updated
1 min read
I

Full-stack developer building free web tools for developers at impeccify.com I write about CSS, web development, and building useful things on the internet. Running a web dev agency + free tools.

Structured data helps Google understand what your pages are about. It gives you rich results in search like FAQ dropdowns and breadcrumbs. I add it to every page I build.

In Next.js App Router, I put structured data in the layout.js file:

const schema = { "@context": "https://schema.org", "@type": "FAQPage", mainEntity: [ { "@type": "Question", name: "How does this work?", acceptedAnswer: { "@type": "Answer", text: "Enter your values and get results instantly." } } ] };

Then render it as a script tag with dangerouslySetInnerHTML.

I usually add 3 schemas per page: FAQ, WebApplication, and BreadcrumbList. After adding these to our tool pages at Impeccify, we started seeing FAQ rich results within 2-3 weeks.

Test your schema at https://search.google.com/test/rich-results before deploying.

Common mistakes to avoid: do not add review schema without real reviews, do not copy schema from other sites without changing URLs, and always make sure FAQ answers match what is actually on the page.

Check impeccify.com to see structured data in action across all our pages.