Replies: 2 comments
-
The solution seems to be returning a title tag with the page.jsx. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I want to set page title to my client rendered pages with
"use client"
.Yes, I have done my research and everyone seems to recommend making the page a server component and move client components to seperate files then import them. This solution just makes no sense in my case. I am building a dashboard, some kind of "web app" and almost all of my pages rely on fetched data with useSWR. Every part of the page depends on that fetched data.
Another discussed solution is placing the metadat in a
layout.js file
for every page. This works for many pages but it does not for dynamic routes. Lets say my client page is at/post/[id]/page.tsx
the title of this page would be in the SWR fetched data which makes it not possible to set it as the page title.I thought of fetching the page title on the server side in the
layout.js
file, but that would double my requests making it a very unideal solution.As far as I understand, achieving such an extremely simple thing is not possible in app router unles I bloat my app in dirs and requests.
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions