diff --git a/src/templates/MarkdownList.jsx b/src/templates/MarkdownList.jsx index 69a769ec..309a5e1c 100644 --- a/src/templates/MarkdownList.jsx +++ b/src/templates/MarkdownList.jsx @@ -10,9 +10,9 @@ import sidebarStyles from '../components/Sidebar.module.scss' export default function MarkdownList({ pageContext }) { const modules = {} - const nested = {} + const nestedModules = {} - function generatedNested(obj, keyPath, value) { + function generatedNested(obj, keyPath, node) { var lastKeyIndex = keyPath.length - 1 for (var i = 0; i < lastKeyIndex; ++i) { var key = keyPath[i] @@ -23,8 +23,8 @@ export default function MarkdownList({ pageContext }) { } if (!obj[keyPath[lastKeyIndex]]) { obj[keyPath[lastKeyIndex]] = { - id: value.id, - label: value.frontmatter.title + id: node.id, + label: node.frontmatter.title } } } @@ -40,7 +40,7 @@ export default function MarkdownList({ pageContext }) { } modules[key].push(node) - generatedNested(nested, modulePath, node) + generatedNested(nestedModules, modulePath, node) }) const moduleKeys = Object.keys(modules).sort() @@ -61,28 +61,28 @@ export default function MarkdownList({ pageContext }) { } } - const g = (title, nested) => { - if (nested.id) { + const generateNestedSidebarList = (title, nestedModules) => { + if (nestedModules.id) { return ( -