Next.js Discord

Discord Forum

metadata not working after implementing next-themes

Answered
ncls. posted this in #help-forum
Open in Discord
So I just installed the next-themes package and implemented it using the documentation: https://github.com/pacocoursey/next-themes#with-app
I then noticed that my page title is suddenly just displaying localhost:3000/ again and I checked another project where I installed next-themes and same issue.

This is just not working afterwards:
export const metadata: Metadata = {
  title: 'My Next App',
  description: 'Generated by create next app',
}


Does someone know why that is and how to fix it?

8 Replies

@joulev can you give us a reproduction repository
I struggle a lot with git. But I will try my best
@ncls. I struggle a lot with git. But I will try my best
can use codesandbox, etc; basically anything so that i can have access to a minimal reproduction version of the nextjs project
@joulev can use codesandbox, etc; basically anything so that i can have access to a minimal reproduction version of the nextjs project
I found out that it is because of making the component a client component
correct, metadata only works in server components
But it needs to be a client component because I need useState
Answer