remove unnecessary sortBy
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user