core
core copied to clipboard
feat: add route option (close #1505)
[!warning] This PR is now based on https://github.com/vuepress/core/pull/1562, so it's expected #1562 to be merged first.
[!tip] For a file like
/a/b.md, the full format is/a/b.htmland clean format is/a/b
Features
This pr adds route option for vuepress config file.
- New
route.cleanUrloption to support the "clean format" pagePatternsandpermalinkPattenis moved toroute.pagePatternsandroute.permalinkPatten
Bug Fixes
Previously, when use manually set a permalink or page path to a clean format like /a, they will always get 404 when trying to visit the page (in any link format). Now, this is correctly handled. Page path will be normalized to a "full" or "clean" version based on cleanUrl, no matter user use "clean", "full" format or mixing them.
Performance Improvements
Now, the key in routes is always the clean format, which avoid outputting uncessary .html suffix for most pages.
Potential Breaking Changes
- Now
inferRoutePathandnormalizeRoutePathreturn the "clean" format instead of "full" format.
Tweaks
Now a new field called routeKey is on the Page object.