@@ -190,10 +190,22 @@ export function buildPageTree(path, ordering = "", content = false) {
191 .sort((a, b) => a.weight - b.weight),
191 .sort((a, b) => a.weight - b.weight),
192 children: Object.fromEntries(
192 children: Object.fromEntries(
195+ const aMetadata = matter(
196+ fs.readFileSync(join(path, a.name, "_index.md")),
199+ const bMetadata = matter(
200+ fs.readFileSync(join(path, b.name, "_index.md")),
203+ return aMetadata?.data?.weight - bMetadata?.data?.weight || 0;
193− subdirs.map((subdir) => [
205+ .map((subdir) => [
194− subdir.name,
206+ subdir.name,
195− buildPageTree(join(path, subdir.name), ordering, content),
207+ buildPageTree(join(path, subdir.name), ordering, content),