Link to a specific section of a Knowledge Base Article

nes
Kilo Explorer

Greetings, we store several of our policies within our Knowledge base.   The policies can be a bit lengthy and have section headings for each topic and sub-section.   We'd like to have customers be taken directly to those specific sections rather than the entire KB article and then have to search for the section.

I notice we can embed source code in the body of the KB article as well.   Is it possible to make a section heading linkable so that if we send a URL to a user they can be take directly to that section of the KB article?

Thanks,

13 REPLIES 13

Matthew,



Did you get a fix for this issue? I am having the same problem. it seems to work fine in the old UI, just an issue in the SP.


No luck. I posted my own thread regarding it, but haven't received any hits.


Update.



I reached out to HI and found that the document linking not working within the Service Portal issue is a known problem (PRB707186). This issue is fixed in Jakarta, but there is an available work-around (attached. pptx file is directly from HI).


Thanks for the response. Ill give it a go and let you all know if it worked for me.


Just an update.



So the fix as is worked for anchors that defined the element as a "name" but not for anchors that referenced an element with an "id".



A small tweak to the code as below, and it was working for most bookmarks. i also reduced the animate time as I thought it was a bit slow.



function (scope, element, attrs, ctrl) {



        element.on('click', '.kb_article a', function(e) {


                  var $this = $(this);


                  var href = $this.attr('href');


                  if (href.indexOf('#') == 0) {


                            e.preventDefault();


                            e.stopPropagation();


                            scrollToAnchor(href.substr(1));


                  }


        });



        function scrollToAnchor(anchor) {


                 


                  var position = $("#"+ anchor).offset() || $(".kb_article a[name=\""+ anchor +"\"]").offset();


                  $("section.page").animate({


                            scrollTop: position.top - $(".kb_article").offset().top


                  }, 500);


        }


}