US English (US)
FR French
DE German
SA Arabic
GR Greek
BS Bosnian

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Book a Demo
  • Product Updates
  • Contact Us
English (US)
US English (US)
FR French
DE German
SA Arabic
GR Greek
BS Bosnian
  • Home
  • Customization
  • Customization Guides
  • Advanced Customization

Changing The Format/Output Of Search Results

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Getting Started
    Users Accessibility New to Helpjuice? Start Here Content Management Multiple Languages/Translations & Localization Multilingual Knowledge Bases Analytics Video Tutorials
  • Customization
    Customization Guides
  • API V2
  • API V3
  • Article Editor
  • Swifty (In-App Widget)
  • Billing / Subscription
  • Authentication
+ More

Modifying the output of your knowledge base's search results is quite straightforward with Helpjuice. The way our search works, is, in our questions.js file, every keystroke + 300ms of nothing happening triggers an ajax call to /search. With the Query being passed as a GET parameter.

Helpjuice returns search results in a JSON format, and our questions.js file already parses that, with the javascript function "show_results" rendering the results and inserting them into the dom. Here's how we can change the output of search results;

1. Open Main layout page

Inside Dashboard click Customize, and then Main Layout, on your left.

2. Replace {{ content_for_header }} with {{ javascript_includes }}

Find the line of code stated {{ content_for_header }}, and replace it with {{ javascript_includes }}. That's right, delete {{ content_for_header }} and insert {{ javascript_includes }}.

3. Over-ride the show_results function

Third and last step is to go to the bottom of the Main Layout page and find the following lines of code, right before the end of the tag:

<script>
function show_results() {
/* this is the function that's called every time Helpjuice renders search results */
}
</script> 

If you'd like a sample of how the show_results function looks like, and how to show various items (such as breadcrumbs), take a look at our sample show_results code.


After changing the show_results function in the Main Layout, every other page is instantly affected, from a search-results stand point, as they all use main-layout as the default layout when rendering.

Please note, if you're stuck, or need any kind of help with customizing your Helpjuice account, feel free to contact us. We will be more than happy to assist you and do apply these changes for you.

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Main CSS
  • Using Custom Inputs On Your Contact Form
  • How To Fix Duplicated Content For SEO Improvement?
  • Shopify/Liquid Variables and Objects Reference

Copyright © 2023 - Helpjuice

Helpjuice, Inc. is a registered US Corporation, EIN # 45-2275731

Download W9
  • Help
  • Features
  • Pricing
  • About
  • Careers
  • Customers
  • Blog
  • Case Studies
  • Resources
  • Knowledge Base Examples
  • Privacy Policy
  • Terms of Service

Why is the knowledge base important?

With a knowledge base, you can allow your customers to self-help themselves, thus reducing your customer support by up to 60%. Furthermore, you can also have your team get instant answers to the questions they need without having to email themselves all using knowledge base software.

What is the purpose of a knowledge base?

The purpose of knowledge base software is to allow you to host your knowledge base/corporate wiki in one centralized 'hub'. Both your customers, and employees can now access information within seconds!

Made with from Miami, Bosnia, Morocco & Brasil

+1 (833) 387 3877 success@helpjuice.com
Expand