Skip to main content

Using the Sheffield Directory Search Widget

About the Search Widget

The Search Widget allows you to embed a search facility for the Sheffield Directory directly into your website, allowing your customers the ability to find relevant services alongside your own content. All information is pulled directly from the Sheffield Directory website which means it is always up to date.

How to embed the Search Widget

Step 1 - Requesting Access

Before you are able to proceed with the process of embedding the Search Widget, you must fulfill the following two criteria:

  1. You must have a valid license, called an API Key. Without it, the Search Widget will not return results and an error message will be displayed.
  2. The domain/IP address of your website must be included in an ‘Allow’ list. Without this inclusion, the Search Widget will not return results and an error message will be displayed.

In order to enable the Search Widget please contact Sheffield City Council via this link, or by sending an email to DisabilityInformationServices@sheffield.gov.uk with the subject line ‘Search Widget Request’. You must provide the following information:

  1. Your Name, Email address and Telephone number.
  2. The Name and Address (URL) of your website.
  3. The purpose/theme of your website so that we can ascertain the suitability of providing the search widget. For example: “Our site provides information and advice to local volunteers and charities.”

Once we have received your request we may contact you for further information.

If your request to embed the Search Widget is granted, we will supply an API key by email.

Step 2 - Adding the Search Widget to your site

Location

Before you add the Search Widget to your site, decide which page, and where on that page, you would like it to appear. We recommend you consider the location that is most relevant to the Widget’s content as the best position for it. This may be your Homepage, or another page within your site.

Once you have chosen the page for the Widget to appear on, you then need to consider its position within that page. This will usually be a column, or sidebar, at least half the width of the page (for a page width of 960 pixels), or a quarter of the width (if the page is wider). We recommend that you do not make the Widget narrower than 300 pixels.

We also recommend the Widget be at least 700 pixels in height, so that search results are displayed with minimal scrolling for the user.

Code

Once you have decided on the location for the Widget, you can proceed to adding the code into your web page. Below is the required code:

<div id="AppPlaceHolder"></div>

<script type="text/javascript" src="//widgets.openobjects.com/search-widget.js"></script>

<script type="text/javascript">

OpenObjects.SearchWidget.load("#AppPlaceHolder",{apiKey: "<your api key>"});

</script>

This code consists of the following:

  1. <div id="AppPlaceHolder"> - This is the start of the Widget. Please ensure there are no other elements on your page with the same ID name.
  2. <script type="text/javascript" src="//widgets.openobjects.com/search-widget.js"></script> - This is the script for the Widget to function.
  3. OpenObjects.SearchWidget.load("#AppPlaceHolder",{ apiKey: "<your api key>" }); - Replace the code ‘<your api key>’ with the actual API key supplied by Sheffield City Council.

Once you have inserted this code, including your API Key, into your web page, refresh the website. The Search Widget should now appear. If the Widget does not load, or it does not appear to be functioning correctly, please re-check you have followed the above instructions. If problems persist, please contact sheffielddirectoryhelp@sheffield.gov.uk.

Back to top
Powered by Open Objects © Open Objects Software Limited