OG Url inheritance #68640
Unanswered
juliansommer
asked this question in
App Router
OG Url inheritance
#68640
Replies: 1 comment
-
|
if there is another way to do this without duplicating a ton of code let me know but I cant find anything |
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.
-
With the way the Metadata API currently works, description and title is inherited and set for og and twitter as well. This is good behavior, however if you need to change one field in the og metadata, you must set ALL og metadata as it will not inherit the fields you do not set. This means if you want to set an og url on each page, you cannot without duplicating all the previously defined metadata from layout.tsx in each page. There's probably 2 ways to fix this, either have og url be inferred from the given canonical, or allow only exporting individual fields in the og object and have the rest inherited from the layout. This would mean either you simply define a canonical on each page (this could ultimately be auto inferred if you are using the nextjs server but thats a seperate topic), or just define the og url and the previous fields still work
Beta Was this translation helpful? Give feedback.
All reactions