Dokz doesn't sort your sidebar links on any particular oder, this is because Dokz generates the sidebar links based on the pages
directory tree
To give a specific order to your sidebar you can use the sidebarOrdering
prop in the DokzProvider
:
1import { DokzProvider } from 'dokz'2import React from 'react'34const order = {5'index.mdx': true,6anotherDirectory: false, // use false to exclude directories and files7pageName: true, // you can omit the mdx extension8folder: {9page1: true,10page2: true,11page3: true,12subfolder: {13page3: true,14page4: true,15},16},17// paths not present will be put at the end18}1920export default function App(props) {21const { Component, pageProps } = props22return (23<ChakraProvider>24<DokzProvider sidebarOrdering={order}>25<Component {...pageProps} />26</DokzProvider>27</ChakraProvider>28)29}
The order is specified with an object, every key is a file or an object path
Every value can be true
, which means the current key is a file path, or can be another object, meaning the current key is directory
If the value is false
the corresponding file or directory will be excluded from the sidebar
Paths that are not in this ordering are put at the end.