You can use the results component to open specific content directly. This is useful when you want to add specific content to a page, for SEO purposes for example.
Use the method openContentById to open content in the results component. In the following example, content 1 is opened:
var results = sdk.component('results', '#results');
results.openContentById(1);Use the method openContentBySlug to retrieve content using a slug from the Knowledge instance:
var results = sdk.component('results', '#results');
results.openContentBySlug('can-i-change-my-flight');You can also open content with a URL. Take either the content's id or slug from the URL:
Example:
1, we can use the URL https://inbenta.com/?faq=1. var faq = getQueryString('faqs'); // This function gets the faq parameter from the query string, in this case return 1.
var results = sdk.component('results', '#results');
results.openContentById(faq);What is Inbenta?, we can use the URL https://inbenta.com/what-is-inbenta. var slug = getUrlSlug(); // This function gets the slug form the url, in this case return 'what-is-inbenta'.
var results = sdk.component('results', '#results');
results.openContentBySlug(slug);