HTML Placement Guide

Where to Put JSON-LD in HTML? Placement & Best Practices

JSON-LD scripts can technically be placed in either the <head> or <body> of an HTML document, but placing them in the <head> is the industry best practice.

Key Technical Takeaways

  • Placing scripts in <head> ensures early crawler discovery during initial document parsing.
  • Multiple <script type="application/ld+json"> blocks on a single page are fully supported.
  • Client-side script injection via JavaScript is supported by Google, but server-side rendering is safer for all search bots.

Implementation Example

<!DOCTYPE html>
<html>
<head>
  <title>Page Title</title>
  <script type="application/ld+json">
  { "@context": "https://schema.org", "@type": "WebPage", "name": "Title" }
  </script>
</head>
<body>...</body>
</html>