Replies: 1 comment
-
@themeix Hi there! I moved this out of issues to Discussions because Discussions is the place for writing up feature requests. |
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.
-
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/strange-mclaren-go8s7s
To Reproduce
Add the following code snippet in the
metadata
object:Current vs. Expected behavior
It would be great if Next.js provided native support for structured data (JSON-LD) within the
Metadata
API, similar to the wayopenGraph
andtwitter
fields are handled. This would improve the developer experience and provide a more streamlined, safe way to manage structured data.Provide environment information
Which area(s) are affected? (Select all that apply)
Metadata
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local)
Additional context
In the latest version of Next.js (14.2.13), there is no built-in support for structured data (JSON-LD) within the
Metadata
API. Currently, developers have to manually inject structured data using<script>
tags withdangerouslySetInnerHTML
, which is not ideal from both a developer experience and security standpoint.Currently, we have to manually inject JSON-LD structured data using the following approach:
While this works, it requires us to handle HTML manually and use
dangerouslySetInnerHTML
, which is not as safe or convenient as a native solution.We are requesting the addition of a structuredData field (or a similar mechanism) within the
Metadata
API that allows developers to define JSON-LD structured data directly in the metadata object. For example:Beta Was this translation helpful? Give feedback.
All reactions