How can I change title of page in client components
Answered
Greek Harehound posted this in #help-forum
Greek HarehoundOP
How can I change title of page in client components
Answered by Ray
why is it difficult?
export const metadata = {
title: "title"
}
export default function Page() {
return <TheClientComponent />
}11 Replies
@Greek Harehound How can I change title of page in client components
can you set it on server component and render the client component in it?
@Ray can you set it on server component and render the client component in it?
Greek HarehoundOP
It is difficult for me because project is ended, i can't change it rn
why is it difficult?
export const metadata = {
title: "title"
}
export default function Page() {
return <TheClientComponent />
}Answer
Greek HarehoundOP
because there is too many pages
it should be easier than trying to change the title in client component
Greek HarehoundOP
Oh sorry i made a typo
How can i change it on client side page
well you can do that with
useEffectuseEffect(() => {
document.title = "new title"
}, [])but it is not seo friendly
Greek HarehoundOP
It is not important thank you ðŸ™ðŸ»