Replies: 1 comment
-
It's complicated right now because of server rendering. React 19 adds support for metadata anywhere in the component tree, but it hasn't been released yet. |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Simplify
generateMetadata
function so that we don't have to jump through hoops to set the metadata.Background
For dynamic pages where the metadata and page content depends on fetching data from external resources (e.g. database), you end up writing the data fetching logic in a separate function and call that inside in your
Page
andgenerateMetadata
(assuming nofetch
is involved).To avoid multiple calls to fetch data, it is recommended that we wrap the function inside React's
cache
function. I see two issues with that:Proposal
Not an expert here but considering Metadata is part of the App Router pages, why can't I simply set that inside my page component. Or have another variant of
generateMetadata
function which will take a simple object (based on the application data) and return a Metadata object as returned currently by this function.Beta Was this translation helpful? Give feedback.
All reactions