0

I was tasked on putting json-ld schema on a website - seeing however that the particular schema is biggish I wanted to link it, as you would link any other script (so - it would be <script src='http://foo.bar/json.jsonld' type="application/ld+json"></script>). Is there a way to do it?

Browsing through the documentation at json-ld.org gives me nothing of such thing; on the other hand I'd find it surprising, as I'd gather crawling an external resource shouldn't be a bother and it would certainly spare me administrative headache (have each object json-ld schema be defined in a json file, identified by id of object). I can echo the contents of those files as well, so it's not really an obstacle, but was wondering if I couldn't just link these files.

eithed
  • 3,933
  • 6
  • 40
  • 60

1 Answers1

1

You can obviously do it but search engines won't consume it if you just reference it. Google, for instance, supports dynamically embedded JSON-LD though. So you could reference it and write a small JavaScript function that looks for <script src="..." type="application/ld+json"></script> tags, fetches the content and embeds it in the document.

Markus Lanthaler
  • 3,683
  • 17
  • 20
  • Yes - I definitely can embed it using various methods. I'm asking if (and if not, then why) is it possible to link these files. – eithed Apr 20 '16 at 08:40
  • By just simply linking the files would be nice, but this assumes that schema.org or what ever schema you are using has the capability to scan the webpage and then gather context of your objects by itself. **Part** of the issue that json-ld remedies is adding context, where there may be ambiguity. You have to supply the context. – Chef_Code Apr 20 '16 at 16:09
  • As I said. It is technically possible but search engines won't consume the data if it is just referenced (in contrast to bein embedded). – Markus Lanthaler Apr 21 '16 at 07:15