I'm writing the Schema.org JSON-LD for a website now. For a url within my site, what will work / best practice?

"url": "http://myawesomesite.com/content.html"


"url": "/content.html"

For Schema.org, JSON-LD, and conforming consumers, it doesn’t matter.

The relative form is shorter and doesn’t require changes if you change the domain. But if a consumer happens to access your document under a different URL, the URL values will be different, too.

The absolute form is what you’d use anyway for external links, and it helps making sure that consumers will always end up at the intended place. But it’s somewhat longer, and if you want to change the domain, you have to update your structured data.

| improve this answer | |

Unfortunately I don't have enough reputation to add a comment to @unor's answer. I want to confirm that what he says is true with some evidence.

I had the same question and end up doing some research. The key part is this:

If you paste markup directly into google validator and there is a relative path - validator doesn't know which domain it belongs to and just appends its own domain (https://search.google.com). Once you deploy changes and test with real url you'll see that validator will append correct domain, so you can definitely use relative urls in structured data.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.