What is static metadata?
Static metadata in Next.js is metadata that is known in advance and does not depend on the request, route parameters, or user data. It is described once and used on every render of a page or layout.
In other words:
static metadata is a fixed SEO description of a page or section.
How static metadata is defined
Static metadata is declared through exporting a metadata object:
ts
export const metadata = {
title: 'About the company',
description: 'Information about our company'
}Next.js automatically turns this into:
<title><meta name="description">- and other needed tags
Without any manual work with <head>.
Where static metadata can be used
Static metadata can be defined in:
page.tsxlayout.tsx- nested layouts
- route groups
Metadata is inherited top-down.
When to use static metadata
Static metadata fits when:
- the page's content doesn't change
- the URL always describes the same thing
- no parameters (
params) are needed - cookies, headers, and authorization don't matter
Examples:
- the home page
- an "About us" page
- landing pages
- documentation
- site sections
What you can describe
Through static metadata you can set:
titledescriptionkeywordsrobotsicons- Open Graph
- Twitter Cards
alternates(canonical, hreflang)
All in one object.
Relation to performance
Static metadata:
- does not require running code
- does not make requests
- can be processed at build time
This is:
- faster
- more predictable
- ideal for SEO
Difference from dynamic metadata
| Static metadata | Dynamic metadata |
|---|---|
A metadata object | A generateMetadata function |
| Does not depend on data | Depends on params, fetch |
| Fixed | Computed every time |
| Faster | Slightly heavier |
| Fits static pages | For dynamic routes |
Summary
Static metadata is:
- metadata known in advance
- a simple, declarative approach
- the best option for static pages
- a fast, safe way to do SEO settings
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.