Next.js SEO · Part 7 · App Router
A first SEO-friendly page in Next.js 16
How the App Router turns folders into pages, what a first page looks like, and how to check that its content is in the HTML.
The examples use a fictional JavaScript learning website.
How the App Router works
In Next.js, folders and special files decide which pages exist on a website. For example:
- app/
- layout.tsxShared layout
- page.tsxHome page, /
- tutorials/
- page.tsx/tutorials
For example, app/tutorials/page.tsx defines the /tutorials page.
Writing the first page
Create this file:
export default function TutorialsPage() {
return (
<main>
<h1>JavaScript Tutorials for Beginners</h1>
<p>
Learn JavaScript step by step with
simple examples.
</p>
</main>
);
}Here is what each important part does:
export defaulttells Next.js which component represents the page.function TutorialsPage()defines a React component.return (...)describes what should appear on the page.<main>marks the main content area.<h1>gives the page a main heading.<p>adds a paragraph.
These are JSX elements, which React uses to describe UI.
What happens when the page opens
When someone visits http://localhost:3000/tutorials, Next.js can send HTML that contains the heading and paragraph. A simplified version of that HTML:
<main>
<h1>JavaScript Tutorials for Beginners</h1>
<p>
Learn JavaScript step by step with
simple examples.
</p>
</main>This matters for SEO because the content is already in the HTML response. A crawler doesn't have to run browser JavaScript to create it.
The HTML head in Next.js
Part 2 wrote the head by hand:
<head>
<title>JavaScript Tutorials</title>
<meta
name="description"
content="Learn JavaScript from scratch."
/>
</head>In the Next.js App Router, this information is usually defined through the Metadata API instead of adding these tags to each page by hand.
For example, a Server Component page or layout can export a metadata object, and Next.js generates the matching HTML tags.
Verifying the page
In a Next.js 16 project, create the file above, then check the result.
1.Start the dev server
npm run dev2.Open the page
Open http://localhost:3000/tutorials in the browser.
3.Search the page source
Right-click and choose View Page Source, then search for JavaScript Tutorials for Beginners. The heading text should be in the returned HTML.

Finding text in View Page Source: the browser's find bar shows how many times it appears.