AddSearch is an instant search for websites that gives results immediately and is very easy to install. Implementing the AddSearch instant search onto your Drupal site can be done by following these instructions.
How to Install AddSearch onto a Drupal Site
First, find your Site key by following these instructions:
- Login to your AddSearch Account
- Go to Keys and installation under Setup
- Copy your site key under Your Site Key
Use our Search Designer tool to configure the widget according to your needs and copy the installation script. Then paste the script into your website template where you would like the AddSearch field to appear. Here is an example of what the script snippet might look like:
<script>
window.addsearch_settings = {
"asw_01": {
"show_search_suggestions": false,
"search_suggestion_position": "left",
"default_sortby": "relevance",
"display_date": false,
"display_meta_description": false,
"display_result_image": true,
"link_target": "_self",
"hide_logo": false,
"direction": "ltr",
"analytics_enabled": false,
"automatic_filter_results_by_site_language": false
}
}
</script>
<script src="https://cdn.addsearch.com/v5/addsearch-ui.min.js?key=xxxxxx&id=asw_01"></script>
Apply the Script to any Page on Drupal Admin
- Login to your Drupal Admin
- Go to the “Content” section from the admin menu on top. Then click “Add Content” or “Edit” for any existing page
- Click on “Source” and paste the AddSearch script where you would like the search bar to appear, then click “Save”
- Congrats, you’re done! Try out your search by typing a letter into the search box
Apply the Script as a New Block on Drupal Admin
- Login to your Drupal Admin
- Go to the “Structure” section from the admin menu on the top of the page and click on Block Layout
- Click on the “Add Custom Block” button
- Fill in the “Description”, click the source button and paste the search script into the “Body” text area. Select “Full HTML” from the “Text Format” dropdown
- Choose the region for the block from “region settings”. This is the area where the search block will be visible. For this example, we have chosen “header”. After making your selection, click “Save”
- Congrats, you have added the AddSearch search box as a new block!