Embed Search Queries
The Hub gives you the ability to search our entire database and display the results on your website through the use of a couple of lines of code.
How do I get this on my website?
It's simple. All you need to do is add this line of code - along with a combination of configuration options - anywhere you want on your website:
<thehub:search></thehub:search> <script async src="//thehub.scot/share/embed.js" charset="utf-8"></script>
For example, here I have asked to show the latest 3 livestreams by Independence Live:
There are 10 different areas to search in ("all", "articles", "media", "videos", "livestreams", "podcasts", "events", "facts", "fundraisers" & "posts")
You can also search specific groups or members by using "group=" or "member=" in your query.
If you wish to search using a keyword, use the "searchTerm=" option.
There are 2 additional theme options available to use ("expanded" & "compact") and this can be set by using the "theme" parameter.
As an example, here I am searching for any articles by Lesley Riddoch
<thehub:search area="articles" group="LesleyRiddoch" limit="4" ></thehub:search> <script async src="//thehub.scot/share/embed.js" charset="utf-8"></script>
You can change the width of the events area by adding a width attribute:
<thehub:search width="300px"></thehub:search> <script async src="//thehub.scot/share/embed.js" charset="utf-8"></script>
You can also limit the number of results that are returned (maximum of 20) and use your own stylesheet to make sure the events display to match the look and feel of your website:
<thehub:search limit="6" css="http://site.com/path/to/stylesheet.css"></thehub:search> <script async src="//thehub.scot/share/embed.js" charset="utf-8"></script>