1. ホーム
  2. seo

What's a `<script type='application/ld+json'>{jsonObj}</script>` in a `head` section do?

2023-08-09 12:04:25

Question

I got this link but didn't understand well. Saw:

<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "WebSite",
    "url": "http://website.com",
    "name": "wbs",
    "description": "Web Studio"
}
</script>

in a source code.

How a code snippet like above in my website header help me or my site?

How to solved?

In your example, the script element is used as data block , which contains JSON-LD ( type="application/ld+json" ).

JSON-LD is a RDF serialization. It allows you to publish Linked Data (or structured data) using JSON. In your example, the vocabulary Schema.org is used ( "@context": "http://schema.org" ).

This structured data can be used by any interested consumer. Prominent consumers are the search engines Bing, Google, Yahoo, and Yandex, which support structured data that uses the vocabulary Schema.org. One use case they have is displaying more details in their result snippets.

Your example probably doesn’t lead to such an enhanced snippet. You have to check the search engine’s documentation if you want to know what features they offer and which structured data you have to provide for these. For example, Google uses the WebSite type (that’s used in your example) for their Sitelinks Search Box , but you would have to add a potentialAction in addition (for the search function).