-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
html/template: "application/ld+json" MIME type is not understood as JS #26053
Labels
Milestone
Comments
eklitzke
added a commit
to eklitzke/go
that referenced
this issue
Jun 25, 2018
This change teaches the text/html package to understand the "application/ld+json" MIME type (used for JSON-LD data) as Javascript, so it can be escaped contextually. Fixes golang#26053
eklitzke
added a commit
to eklitzke/go
that referenced
this issue
Jun 25, 2018
Teach the text/html package to understand the "application/ld+json" MIME type (used for JSON-LD data) as JS, so it can be apply the correct contextual escaping. Fixes golang#26053
Change https://golang.org/cl/120835 mentions this issue: |
For the purposes of |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
The text/html package does not understand the "application/ld+json" MIME type to be JS. This is a standard format endorsed by the W3C and various search engines. Search engines like Google require this data to be inline in a page's HTML using a tag like
<script type="application/ld+json">JSON DATA HERE</script>
, so it is important for the text/html template engine to be aware of how to escape JSON-LD data, as the data cannot be placed in an external script file. For more information on JSON-LD see [1] and [2].I plan to submit a trivial PR to add json+ld support to text/html, but I am creating a GitHub issue first to describe the issue as per the contribution policy.
[1] https://en.wikipedia.org/wiki/JSON-LD
[2] https://developers.google.com/search/docs/guides/intro-structured-data
The text was updated successfully, but these errors were encountered: