Skip to content

Commit 11e9a3f

Browse files
committed
fix jumpTo menu order in tutorial pages.
1 parent 4b7e161 commit 11e9a3f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/pages/_utils.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ export const generateJumpToState = async (
377377
category === getExampleCategory(currentEntrySlug)
378378
) {
379379
// Get all entries in the current category
380-
const currentCategoryEntries = localeEntries.filter(
380+
let currentCategoryEntries = localeEntries.filter(
381381
(entry) =>
382382
category ===
383383
(collectionType === "examples"
@@ -386,6 +386,14 @@ export const generateJumpToState = async (
386386
entry.data.category ?? ""),
387387
);
388388

389+
if (collectionType === "tutorials") {
390+
currentCategoryEntries = currentCategoryEntries.sort(
391+
(a, b) =>
392+
((a.data as any).categoryIndex ?? 1000) -
393+
((b.data as any).categoryIndex ?? 1000),
394+
);
395+
}
396+
389397
// Add the entries in the category to the jumpToLinks
390398
categoryLinks.push(
391399
...currentCategoryEntries.map(

0 commit comments

Comments
 (0)