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
  • 87,575
  • 24
  • 195
  • 335
M.J
  • 53
  • 1
  • 5
  • 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,558
  • 16
  • 20