What's a `<script type='application/ld+json'>{jsonObj}</script>` in a `head` section do?
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).
関連
最新
-
nginxです。[emerg] 0.0.0.0:80 への bind() に失敗しました (98: アドレスは既に使用中です)
-
htmlページでギリシャ文字を使うには
-
ピュアhtml+cssでの要素読み込み効果
-
純粋なhtml + cssで五輪を実現するサンプルコード
-
ナビゲーションバー・ドロップダウンメニューのHTML+CSSサンプルコード
-
タイピング効果を実現するピュアhtml+css
-
htmlの選択ボックスのプレースホルダー作成に関する質問
-
html css3 伸縮しない 画像表示効果
-
トップナビゲーションバーメニュー作成用HTML+CSS
-
html+css 実装 サイバーパンク風ボタン