mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
Website: Update "On this page:" links on documentation pages. (#21580)
Changes: - Updated how "On this page" links are generated for /docs pages.
This commit is contained in:
parent
9353d091fe
commit
c646d0ac51
1 changed files with 4 additions and 6 deletions
|
|
@ -129,13 +129,11 @@ parasails.registerPage('basic-documentation', {
|
|||
// console.log(subtopics);
|
||||
|
||||
this.subtopics = (() => {
|
||||
let subtopics = $('#body-content').find('h2.markdown-heading').map((_, el) => el.innerText);
|
||||
subtopics = $.makeArray(subtopics).map((title) => {
|
||||
// Removing all apostrophes from the title to keep _.kebabCase() from turning words like 'user’s' into 'user-s'
|
||||
let kebabCaseFriendlyTitle = title.replace(/[\’\']/g, '');
|
||||
let subtopics = $('#body-content').find('h2.markdown-heading').map((_, el) => el);
|
||||
subtopics = $.makeArray(subtopics).map((subheading) => {
|
||||
return {
|
||||
title,
|
||||
url: '#' + _.kebabCase(kebabCaseFriendlyTitle.toLowerCase()),
|
||||
title: subheading.innerText,
|
||||
url: $(subheading).find('a.markdown-link').attr('href'),
|
||||
};
|
||||
});
|
||||
return subtopics;
|
||||
|
|
|
|||
Loading…
Reference in a new issue