Currently we are using following JavaScript as a workaround:
<script type = "text/javascript" >
window.onload = function() {
let e = 'https://' + window.location.hostname + '/graphql?query={pages{search(query:"' + window.location.pathname.substring(window.location.pathname.lastIndexOf('/')) + '/"){results{path,title,description}}}}';
fetch(e)
.then(function(e) {
return e.json();
})
.then(function(e) {
let t = e.data.pages.search.results,
n = document.getElementById("toc");
t.sort(function(a, b) {
let titleA = a.title.toUpperCase();
let titleB = b.title.toUpperCase();
if (titleA < titleB) {
return -1;
}
if (titleA > titleB) {
return 1;
}
return 0;
});
n.innerHTML = "";
for (let e = 0; e < t.length; ++e) {
let i = document.createElement("li"),
a = document.createElement("a");
a.setAttribute("href", "/" + t[e].path), a.setAttribute("class", "is-internal-link is-valid-page"), (a.innerHTML = t[e].title + "<em>" + t[e].description), i.appendChild(a), n.appendChild(i);
}
});
};
</script>
add this to the script sections of a page and add following html to the page content while using the markdown or code editor:
<ul class="links-list" id="toc"></ul>