2

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?

unor
  • 92,415
  • 26
  • 211
  • 360
Bodine
  • 39
  • 1
  • 9

1 Answers1

5

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.

Community
  • 1
  • 1
unor
  • 92,415
  • 26
  • 211
  • 360
  • Thank you for your complete answer, this is what I needed to know. I think I got it. I have a shopping cart so I am taking this as I can input "Product" under each one. Thanks again! – Bodine Aug 19 '16 at 21:21