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