nextjs's Introduction
nextjs's People
nextjs's Issues
Next.js 13.2 - Built-in SEO support with new Metadata API
Built-in SEO support with new Metadata API
The new Metadata API allows you to define metadata (e.g. meta and link tags inside your HTML head element) with an explicit metadata configuration in any layout or page that is a Server Component.
// Static metadata
export const metadata = {
title: '...',
};
// Dynamic metadata
export async function generateMetadata({ params, searchParams }) {
const product = await getProduct(params.id);
return { title: product.title };
}
지금 레포에서는 SEO 컴포넌트를 따로 빼서 설정하고 있던데
Next.js 13.2 부터 업데이트된 메타데이터 API를 사용하면 코드상에서 명시적으로 메타데이터 구성이 가능해요!
🎁 아래와 같이 코드를 변경해보는건 어떨까요?
Current
import Seo from "../components/Seo"
export default function About() {
return (
<div>
<Seo title="About" />
<div>About Page</div>
</div>
);
Suggested change
export const metadata = {
title: 'About',
};
export default function About() {
return (
<div>
<div>About Page</div>
</div>
);
}
ref.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.