Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do I put Google's JSON-LD structured data?

I am trying to create Googles structured data no clue what I am doing. I set it up as an Organization then used the SD markup tool for all my products. I put each JSON-LD product inside it's own script tag directly from the markup tool vs. nesting. Then I put this in a .js file on my server. I linked it in my header with this

<script src="../Scripts/structureddata.js"></script>

I had tested it in the SD tool using the url and it didn't see it. Then I copied the structureddata.js into the tool, it say that so then I corrected any warnings and errors it showed my 50 products. Tried again and it does not see it from the url. I can see it inside the Search Console it shows 1 item. I am "assuming" from reading it only shows one...?

Can anyone help me with this. Should I have put it in a .js file? Can I use a link to a .js file? Why won't the SD tool see the structured data from my linked file?

like image 549
Bodine Avatar asked Sep 02 '25 06:09

Bodine


1 Answers

You have to include the JSON-LD in a script element used as data block:

<script type="application/ld+json">
  {
   "@context": "http://schema.org",
   "@type": "Thing"
  }
</script>

You can place this script element in the head or somewhere in the body.

Google doesn’t seem to support JSON-LD in external files. For their search features, they currently only support JSON-LD (as in the example above), Microdata, and RDFa.

like image 109
unor Avatar answered Sep 05 '25 01:09

unor