Git Product home page Git Product logo

nextjs's Introduction

nextjs's People

Contributors

samsam-lee avatar

Watchers

 avatar

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.