1

In my .NET Core Web App I use the library (NuGet package) Schema.NET which appends the following JSON-LD (the library doesn't really matter because it's clearly not its fault):

<script type="application/ld+json">
    {
      "@context":"https://schema.org",
      "@type":"WebSite",
      "name":"example.com",
      "alternateName":"example.com - My favourite website",
      "url":"https://example.com"
    }
</script>

This gets added right after the title tag (in head) just like in Google's example.

The problem is that when I use the rich results test from Google the crawler successfully crawls the website, SEES the code in there and still says there's no rich content or whatever you wanna call it. Why?? What did I do wrong here?

My relevant C# code used to generate the JSON-LD above:

@{
      var website = new WebSite()
{
    AlternateName = "example.com - My favourite website",
    Name = "example.com",
    Url = new Uri("https://example.com")
};
var jsonLd = website.ToString();

}
<script type="application/ld+json">
@* THIS IS NOT PROTECTED AGAINST XSS AND SIMILAR, MEANING YOU CAN ONLY USE TRUSTED VALUES HERE A.K.A. NO USER INPUT HERE!! *@
    @Html.Raw(jsonLd)
</script>

Please note that the output is actually minimized a.k.a. without unnecessary whitespaces, but for better visibility I added newlines and etc, which doesn't help for Googlebot according to the rich results test tool either...

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
Munchkin
  • 857
  • 5
  • 24
  • 51

1 Answers1

3

The Rich Result Tester only reports on Structured Data that contributes to Rich Results in Google.

Their Search Gallery is a good place to learn about what can cause Rich Results:

https://developers.google.com/search/docs/advanced/structured-data/search-gallery

Tony McCreath
  • 2,882
  • 1
  • 14
  • 21
  • 1
    So the `WebSite` schema.org object is just unsupported by Google? Because I can't find it in any Google documentation – Munchkin Nov 22 '21 at 10:47
  • The thing is I added a `LocalBusiness` object, which appears to be supported by Google or at least in the documentation but it's still not recognizing it.. Or maybe you're not allowed to have multiple JSONs in a single `script` tag? – Munchkin Nov 22 '21 at 10:50
  • Yup, I had to split the `script` tag for each JSON, just tried it out – Munchkin Nov 22 '21 at 11:10
  • The rules are mixed and I think LocalBusiness markup is only of rich snippet value for sites that have content about other businesses. – Tony McCreath Nov 23 '21 at 12:31