Jump to content

Javascript error with Google Sitelinks Search Box when javascript moved to end


skinnybloke

Recommended Posts

Hi - I am trying to set-up Google Sitelinks Search Box for my website

 

See: https://developers.google.com/webmasters/richsnippets/sitelinkssearch

 

I have added this code into the HEAD of header.tpl

<script type="application/ld+json">   
{
      "@context": "http://schema.org",
      "@type": "WebSite",
      "url": "{$base_uri}",
      "potentialAction": {
      "@type": "SearchAction",
      "target": "{$base_uri}search?controller=search&orderby=position&orderway=desc&search_query={literal}{search_term_string}{/literal}",
      "query-input": "required name=search_term_string"
      }
  }
</script>
 

This gives me the following javascript error when I have 'Move JavaScript to the end' enabled in the performance screen. There are no errors when it is disabled.

 

 

Any ideas?

Edited by skinnybloke (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...