Link to a specific section of a Knowledge Base Article
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2017 08:23 AM
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,
- Labels:
-
Knowledge Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2017 11:19 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 09:34 AM
No luck. I posted my own thread regarding it, but haven't received any hits.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2017 12:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2017 11:12 PM
Thanks for the response. Ill give it a go and let you all know if it worked for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2017 06:40 PM
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);
}
}