Add search box widget to your site

Edicy provides search widget to search the contents of your site through Google. Adding this widget requires three things included in your templates: a default stylesheet file, google search javascript file and a form with search box. Fortunately, all of them are provided by Edicy. See more inside on how to add working search box to your site.

You can include default stylesheet for your search results from Edicy. Add this code block into the HEAD tag of your templates:

{% if site.search.enabled %}
{% stylesheet_link "assets/site_search/2.0/site_search.css" static_host="true" %}
{% endif %}

Next you need to initialize javascript that makes search to Google and draws search results widget:

{% if site.search.enabled %}
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript"
  src="http://static.edicy.com/assets/site_search/2.0/site_search.js"></script>
<script type="text/javascript" charset="utf-8">
  var search_translations = {
    "search": "{{ "search"|lc }}", "close": "{{ "search_close"|lc }}",
    "noresults": "{{ "search_noresults"|lc }}"
  };
</script>
{% endif %}

And finally, make INPUT element with ID onpage_sarch:

{% if site.search.enabled %}
<div id="search"><form action="">
<div><input type="text" id="onpage_search"/></div>
</form></div>
{% endif %}

Please note that site object has a property search.enabled that marks whether the search is turned on from site settings view.