Next.js Discord

Discord Forum

Metadata and title not displaying

using next.js latest.

title was working using Helmet, but nothing is working with Head

6 Replies

@πšπš’πš–πšžπš£πš”πšŠπšœ using next.js latest. title was working using `Helmet`, but nothing is working with `Head`
the way how metadata is defined has changed from pages router to app router. I guess you are using the app router right now, so you need to use the app router syntax:
https://nextjs.org/docs/app/building-your-application/optimizing/metadata

TL;DR:
Do this:
import type { Metadata } from 'next'
 
export const metadata: Metadata = {
  title: '...',
  description: '...',
}
 
export default function Page() {}
Answer
thx, that worked!