From 186d7687ff63210ed04bdbbc6f6ca5ab7b0773db Mon Sep 17 00:00:00 2001 From: Ross Moody Date: Wed, 27 May 2026 11:42:13 -0700 Subject: [PATCH] fix: apply root-level meta.jsonc order config The findPathForJsonc and subPath helpers both required a leading/trailing slash that the root case doesn't have, so root-level meta.jsonc was never matched and the configured order silently fell back to alphabetical sort. Making the slashes optional fixes root-level config matching without changing behavior for nested configs. Reproducible by giving any group a root meta.jsonc and observing that clicking the group's nav landed on an alphabetically-first page instead of the order's first item. --- src/build/plugins/markdown-pages/sort.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/build/plugins/markdown-pages/sort.js b/src/build/plugins/markdown-pages/sort.js index ef9cecad..a38c25c0 100644 --- a/src/build/plugins/markdown-pages/sort.js +++ b/src/build/plugins/markdown-pages/sort.js @@ -11,7 +11,7 @@ function uniq(arr) { * @returns {string} */ function findPathForJsonc(path) { - return path.replace(/\/meta\.jsonc?$/, ''); + return path.replace(/\/?meta\.jsonc?$/, ''); } /** @@ -134,7 +134,7 @@ export function sortTree(tree, configs, parents = []) { tree.pages.map((subTree) => sortTree(subTree, configs, [...parents, tree.path])); if (configs.length > 0) { - const subPath = `${[...parents, tree.path].join('/')}`.replace(/^root\//, ''); + const subPath = `${[...parents, tree.path].join('/')}`.replace(/^root\/?/, ''); const config = configs .filter(Boolean) .find((config) => findPathForJsonc(config.path) === subPath)?.config;