As same as Umi, dumi has a set of routing generation conventions.
Dumi will generate routes based on the base detection path which is taken by the value of the configuration item of
resolve.includes. If we do not configure this value, dumi will detect the
packages/pkg/src(lerna projects) directory by default.
It is assumed that
docs has the following directory structure, dumi will identify it like this:
.└── docs/├── index.md # generate '/' route├── index.zh-CN.md # generate '/zh-CN' route├── examples.md # generate '/examples' route├── guide| ├── README.md # generate '/guide' route| ├── help.md # generate '/guide/help' route
It can be found that, except for the multi-language part, it is very similar to rules of Umi for identifying
tsx/jsx Convention routes.
In addition, dumi will convert camel cased(camelCased) to kebab case(kebab-case), for example,
docs/gettingStarted will be converted to
The default rule of generating page title is to take the last segment of the current route and capitalize it. For example, if the route is
/guide/help, dumi will take the end route
help and capitalize it to
If you want to control the page title in manual way, you can configure it through The frontmatter configuration of
In the side menu, the pages will be sorted according to the rules.
The default rule of the page sorting is: firstly, compare the length of
path, for example
/guide must be in front of
/guide/help, and then compare the ASCII of page name, for example,
Guide must be in front of
If you want to control the page order in manual way, you can configure it through The frontmatter configuration of
order. The smaller the number, the more previous the rank will be.
At present, the route of the page itself cannot be customized. Dumi will abide by the agreement that name is route. If you want to change the route of the page, for example, changing the
other, it is recommended that change
However, except the route of the page itself, the route of the menu and navigation to which the page belongs can be changed. For more, please refer to Control menu generate and Control navigation generate.
Generally, it is recommended to use the conventional routing directly. If it can not satisfy the requirements, can also configure through
config.routes. The usage is the same as Umi, but there are two points to notice:
.mdas a routing component for now. The standard
modulewill be supported in the future