Developers

Contents

Overview

This subcomponent is defined to show the content attributes, related contents and decision tree contents defined in the Knowledge instance.

Usage

This component is located inside many components such as Results, Popular or Deflection. It can be tuned changing its options from the parent component. For details, see the example below.

Sample

By default, this component looks like this:

Options

Available options to set in this component

Name Type Default Description
settingsToShow array ['ANSWER_TEXT'] array of settings to should be show in the content
settingsImg string Settings to show an image before content title
showDecisionTree boolean true Show decision trees to navigate to other contents.
showRelated boolean false Show related contents
Caution: Inbenta does not recommend this option if there are more than five related contents to display.
showRelatedRatings boolean true Show ratings for related contents.
maxRelated integer null Limit the maximum related contents to be displayed within a content.
openContentOnClick boolean true Show content body when content title is clicked.

Default options object

{
  settingsToShow: ['ANSWER_TEXT'],
  settingsImg: '',
  openContentOnClick: true,
  showDecisionTree: true,
  showRelated: false,
  showRelatedRatings: true,
  maxRelated: null,
  ratings: { <more info in subcomponent> }
}

Methods

This subcomponent does not have any methods.

Subcomponents

This component has some components inside which can be configured. This components are:

Name Description
ratings Component to render the ratings
related Component to render the related
decisionTree Component to render the Decision Tree

Events

This subcomponent does not have any events.

Tracking

This component calls the API endpoint /tracking/events to register a click event when a user clicks on a content.

Example

Create popular with contents settingToShow to SHORT_ANSWER_TEXT.

sdk.component('popular', '#popular', {
  contents: {
    settingsToShow: ['SHORT_ANSWER_TEXT']
  }
});