-
Notifications
You must be signed in to change notification settings - Fork 919
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: add route option (close #1505) #1538
base: main
Are you sure you want to change the base?
Conversation
ab871fa
to
f05b2e9
Compare
Pull Request Test Coverage Report for Build 13475324265Details
💛 - Coveralls |
now e2e test is added in this PR |
c5baa4e
to
9e3789c
Compare
a9c1418
to
bddd418
Compare
bddd418
to
fdefcd8
Compare
In the - .e2e-theme-content #hash-and-query + ul > li a
^^^^^^^^^^^^^^
+ .e2e-theme-content #query-and-hash + ul > li a which causes the e2e test to fail due to the inability to find the element. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regular expression here does not satisfy path matching after enabling cleanUrl
. For strings in the format of /xxx
, it always returns false
, and the value of href
in linksPlugin
is skipped during parsing, resulting in /xxx
instead of /xxx.html
.
The regular expression requires that the path
part must end with /
, .html
, or .md
, and it is clear that /xxx
does not meet this requirement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is excepted, even with cleanUrl, users are required to add .md extension .
Warning
This PR is now based on #1562, so it's expected #1562 to be merged first.
Tip
For a file like
/a/b.md
, the full format is/a/b.html
and clean format is/a/b
Features
This pr adds
route
option for vuepress config file.route.cleanUrl
option to support the "clean format"pagePatterns
andpermalinkPatten
is moved toroute.pagePatterns
androute.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 oncleanUrl
, 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
inferRoutePath
andnormalizeRoutePath
return the "clean" format instead of "full" format.Tweaks
Now a new field called routeKey is on the
Page
object.