Google SDTT error: “All values provided for http://www.example.com/ must have the same domain.”

前端 未结 7 1555
太阳男子
太阳男子 2020-12-31 07: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.

相关标签:
7条回答
  • 2020-12-31 07:22

    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.

    0 讨论(0)
  • 2020-12-31 07:34

    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.

    0 讨论(0)
  • 2020-12-31 07:38

    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.

    0 讨论(0)
  • 2020-12-31 07:41

    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.

    0 讨论(0)
  • 2020-12-31 07:42

    It appears the testing tool assumes example.com as its domain.

    When testing if you can update your url to "www.example.com" it will validate successfully.

    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Organization",
      "url": "http://www.example.com/",
      "contactPoint": [{
        "@type": "ContactPoint",
        "telephone": "+1-401-555-1212",
        "contactType": "customer service"
      }]
    }
    </script>
    
    0 讨论(0)
  • 2020-12-31 07:44

    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.

    0 讨论(0)
提交回复
热议问题