How to set the page title when using app router without using server components?
Unanswered
American black bear posted this in #help-forum
American black bearOP
Hi
I've been trying to set the title tag on one of my app pages (page.tsx), but I haven't been able since as per this documentation (https://nextjs.org/docs/app/building-your-application/optimizing/metadata) the component has to be a server one, but on my case it needs to have the 'use client' directive. I've also tried this (https://nextjs.org/docs/pages/api-reference/components/head) but it conflicts with an implementation I have for google analytics, because it overrides the googletagmanager element when the title is set.
Is there any easy way to set the title that does not involve using server components and also does not get rid of the google tag manager element?
I've been trying to set the title tag on one of my app pages (page.tsx), but I haven't been able since as per this documentation (https://nextjs.org/docs/app/building-your-application/optimizing/metadata) the component has to be a server one, but on my case it needs to have the 'use client' directive. I've also tried this (https://nextjs.org/docs/pages/api-reference/components/head) but it conflicts with an implementation I have for google analytics, because it overrides the googletagmanager element when the title is set.
Is there any easy way to set the title that does not involve using server components and also does not get rid of the google tag manager element?