Portal Knowledge Base - Display "Knowledge Article" number before tittle

F_bio Santos
Kilo Sage

Hi everyone, I have a request where I need to change the "KB Category Page" widget, so that it shows the "Knowledge Article" number before the tittle does anyone know how to do this ?

F_bioSantos_0-1720439117634.png

 

1 ACCEPTED SOLUTION

Slava Savitsky
Giga Sage

Here is a quote from the product documentation:

 

Base system widgets are read-only so you can benefit from future updates. To make changes, you can clone base system widgets.

For more details, see:

Clone a widget

 

In a nutshell, you need to clone "KB Category Page" widget and change the following line

<a ng-href="{{kb_article.link}}">{{::kb_article.title}}</a>

as follows:

<a ng-href="{{kb_article.link}}">{{::kb_article.number}} - {{::kb_article.title}}</a>

 

Then replace the base system widget with your customized widget in the corresponding portal page ("kb_category").

View solution in original post

3 REPLIES 3

Slava Savitsky
Giga Sage

Here is a quote from the product documentation:

 

Base system widgets are read-only so you can benefit from future updates. To make changes, you can clone base system widgets.

For more details, see:

Clone a widget

 

In a nutshell, you need to clone "KB Category Page" widget and change the following line

<a ng-href="{{kb_article.link}}">{{::kb_article.title}}</a>

as follows:

<a ng-href="{{kb_article.link}}">{{::kb_article.number}} - {{::kb_article.title}}</a>

 

Then replace the base system widget with your customized widget in the corresponding portal page ("kb_category").

Hi @Slava Savitsky, it worked but I had to also change somethink on the "Server Script", on the "line 75" I had to add the "number" field to the "kbFields" variable:

 

var kbFields = "sys_view_count,author,rating,sys_updated_on,sys_id,number";


What Im still not sure is on how they get the tittle to work since they are not getting the "short_description".

 

In the "Body HTML template" field, they iterate over data.items object to render information about each article. That object is set in the "Server script" field via a call to getKBCategoryArticleSummaries() function that is defined in the same field and, in its turn, calls getResultData() function of the KBPortalServiceImpl script include. That function then calls a private function _getResult() of the same script include, which finally calls SNC.SearchRequest() API to actually fetch the data. That API does not seem to be documented anywhere and its code is also not accessible for us. It seems that the logic for always returning the value of the Short Description is hardcoded in that API whereas the kbFields variable only lists additional (secondary) attributes.