1
0
mirror of synced 2025-12-21 10:57:10 -05:00

remove unnecessary sortBy

This commit is contained in:
Sarah Schneider
2021-05-21 12:06:39 -04:00
parent d258e77b17
commit e4d464e9b6

View File

@@ -1,7 +1,6 @@
const fs = require('fs').promises
const path = require('path')
const Page = require('./page')
const { sortBy } = require('lodash')
const basePath = path.posix.join(__dirname, '..', 'content')
module.exports = async function createTree (originalPath, langObj) {
@@ -42,13 +41,9 @@ module.exports = async function createTree (originalPath, langObj) {
// Process frontmatter children recursively.
if (item.page.children) {
item.childPages = sortBy(
(await Promise.all(item.page.children
.map(async (child) => await createTree(path.posix.join(originalPath, child), langObj))))
.filter(Boolean),
// Sort by the ordered array of `children` in the frontmatter.
item.page.children
)
item.childPages = (await Promise.all(item.page.children
.map(async (child) => await createTree(path.posix.join(originalPath, child), langObj))))
.filter(Boolean)
}
return item