From e207ddb26bee7a2d5705ac88b0ff70b4e06ca26a Mon Sep 17 00:00:00 2001 From: Artur Paikin Date: Thu, 24 Aug 2017 23:40:00 +0300 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20generate=20sidebar=20links=20fo?= =?UTF-8?q?r=20non-docs=20pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website/themes/uppy/source/js/common.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/website/themes/uppy/source/js/common.js b/website/themes/uppy/source/js/common.js index ae9d18bfb..a0c431073 100644 --- a/website/themes/uppy/source/js/common.js +++ b/website/themes/uppy/source/js/common.js @@ -116,8 +116,11 @@ function initSubHeaders () { // build sidebar var currentPageAnchor = menu.querySelector('.sidebar-link.current') - var isAPI = document.querySelector('.Content').classList.contains('api') - if (currentPageAnchor || isAPI) { + var isDocs = content.classList.contains('docs') + + if (!isDocs) return + + if (currentPageAnchor) { var sectionContainer // if (false && isAPI) { @@ -133,6 +136,7 @@ currentPageAnchor.parentNode.appendChild(sectionContainer) var h2s = content.querySelectorAll('h2') + if (h2s.length) { each.call(h2s, function (h) { sectionContainer.appendChild(makeLink(h)) @@ -140,7 +144,7 @@ allLinks.push(h) allLinks.push.apply(allLinks, h3s) if (h3s.length) { - sectionContainer.appendChild(makeSubLinks(h3s, isAPI)) + sectionContainer.appendChild(makeSubLinks(h3s, isDocs)) } }) } else {