0

In order to have a Google Sitelinks Search Box for your website, you have to include this script in your page:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "WebSite",
  "url": "https://www.example.com/",
  "potentialAction": {
    "@type": "SearchAction",
    "target": "https://query.example.com/search?q={search_term_string}",
    "query-input": "required name=search_term_string"
  }
}
</script>

My question is: Can <script type="application/ld+json"> be external? It is obviously useless for page it self and crawlers can make extra request if they want.

unor
  • 92,415
  • 26
  • 211
  • 360
M.J
  • 63
  • 1
  • 6
  • possible duplicate of [Does JSON-LD have to be embedded?](http://stackoverflow.com/questions/30864619/does-json-ld-have-to-be-embedded) – unor Aug 20 '15 at 13:28

1 Answers1

0

While it can't be external in the traditional sense (using the src attribute), it can be injected by JavaScript.

Markus Lanthaler
  • 3,683
  • 17
  • 20