Metadata API: support custom property attribute values (Facebook sharing) #57527
Replies: 12 comments 4 replies
-
It seems reasonable that we could allow for |
Beta Was this translation helpful? Give feedback.
-
I think it is possible to add an additional array option for the export const metadata: Metadata = {
other: [
{ property: "product:price:amount", content: "9.99"}
]
}; |
Beta Was this translation helpful? Give feedback.
-
+1 Another option - add 'fb' property to OpenGraph section.
|
Beta Was this translation helpful? Give feedback.
-
We also need this |
Beta Was this translation helpful? Give feedback.
-
very much need this! |
Beta Was this translation helpful? Give feedback.
-
Per https://nextjs.org/docs/app/api-reference/functions/generate-metadata#facebook it should be working, but it does not. Problem "Object literal may only specify known properties and 'facebook' does not exist in type 'Metadata'" (Code 2352) is thrown by TypeScript. Next 14.2.5 |
Beta Was this translation helpful? Give feedback.
-
Goals
<meta property="MyCustomProperty" content="MyContent">
.generateMetadata
or exporting static metadata. Currently removing a metadata tag in child components is not possible for tags declared in thehead
:Non-Goals
No response
Background
og
properties for metadata, except thefb:app_id
, which is required.Example:
<meta property="fb:app_id" content="1234567890" />
Metadata
type in Next.js supportsother
fields:The problem is that it will resolve to the
<meta name=...
, while custom<meta property=...
is not supported.Proposal
It seems there are not so many tags missed, like
meta http-equiv="..."
, and the code in Next.JS already picked up the path to include mostly used meta attributes (publisher
,manifest
, etc). Thus is seems there is no need to provide arbitrary attribute creation like<meta my-attr="...
.Introduce new types
Extend the
Metadata.other
field with the properties, also support the previous API:before:
after:
For Facebook sharing it will look like:
Beta Was this translation helpful? Give feedback.
All reactions