Google SDTT error: “All values provided for http:/

2019-02-06 04:03发布

When I copy/paste JSON-LD example from Google Documentation (code-snippet below) I get an error in the Structured Data Testing Tool:

http://www.your-company-site.com (All values provided for http://www.example.com/ must have the same domain.)

Why is Google's own documentation example giving an error?

Code snippet from Google’s documentation:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Organization",
  "url": "http://www.your-company-site.com",
  "contactPoint": [{
    "@type": "ContactPoint",
    "telephone": "+1-401-555-1212",
    "contactType": "customer service"
  }]
}
</script>

7条回答
Summer. ? 凉城
2楼-- · 2019-02-06 04:38

One reason this happens is because of the testing tool's UX. It seems kinda buggy to me.

First run a fresh test on a domain. You will see the Organization url is correct and there are no warnings since all matches.

Now, click in the source code (left pane) and add a single space somewhere harmless. You will see the domain disappears in the top bar: enter image description here

You will also see the warning appear. Hitting "refresh" or starting a fresh test will correct the error again. I'm guessing the reason they do this is because when manually editing schema you are no longer, technically, reflecting the source from a domain.

查看更多
手持菜刀,她持情操
3楼-- · 2019-02-06 04:41

This error started appearing somewhere in the month before your post. Since the error disappears when the "contactPoint" is left out, even though it doesn't contain an URL, this is most likely a bug in the validation tool.

I came across the same problem and asked about it on the support forum.

查看更多
Summer. ? 凉城
4楼-- · 2019-02-06 04:44

They can't prepopulate the examples in their documentation with the URL of the site you are going to write code for. They don't know what site you are writing code for.

查看更多
甜甜的少女心
5楼-- · 2019-02-06 04:47

If you change your URL to "https://search.google.com/structured-data/testing-tool/", the tool will drop the error, just make sure before you put the code on your website that you update it.

Also, checking Search Console is likely a more reliable way (currently) to see if your markup has an error.

查看更多
Viruses.
6楼-- · 2019-02-06 04:51

I found that by implementing the JSON-LD snippet (with your correct details) in your website and clicking on 'New Test' at the top right of the Structured Data Test Page and using your correct URL it will not throw the error.

查看更多
神经病院院长
7楼-- · 2019-02-06 04:57

If you are pasting some code on the page and running it, Google assumes that it should be an example page. Instead do like this,

  1. Test all other except "url"
  2. Update the index.html on your server
  3. Finally run test with your url (Choose New Test > Fetch URL)

Now you will not see the error again.

查看更多
登录 后发表回答