这是indexloc提供的服务,不要输入任何密码
Skip to content

Issue in v2 with structured data #676

@MrRhodes

Description

@MrRhodes

I've just been migrating over to v2 and noticed that Google Search Console was firing errors about my structured data..

<script type="application/ld+json">{&quot;@context&quot;:&quot;https://schema.org&quot;,&quot;@type&quot;:&quot;BlogPosting&quot;,&quot;headline&quot;:&quot; ... 
Structured data with syntax errors detected
Invalid items are not eligible for Google Search's rich results.

seems to be escaping the data, not sure where this is happening. I assume theres some high level escaping that might be doing this as the line in question is just stringifying it

 <script type="application/ld+json" suppressHydrationWarning>
     {JSON.stringify(jsonLd)}
 </script>

..This is pretty much out the box.. clean clone and copy over my source data.

for now i've just gone back to

<script
  type="application/ld+json"
  dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
/>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions