Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add route option (close #1505) #1538

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

feat: add route option (close #1505) #1538

wants to merge 24 commits into from

Conversation

Mister-Hope
Copy link
Member

@Mister-Hope Mister-Hope commented Apr 11, 2024

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.

  • New route.cleanUrl option to support the "clean format"
  • pagePatterns and permalinkPatten is moved to route.pagePatterns and route.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 inferRoutePath and normalizeRoutePath return the "clean" format instead of "full" format.

Tweaks

Now a new field called routeKey is on the Page object.

@Mister-Hope Mister-Hope linked an issue Apr 11, 2024 that may be closed by this pull request
@meteorlxy meteorlxy changed the title feat: add route option feat: add route option (close #1505) May 14, 2024
@coveralls
Copy link

coveralls commented May 16, 2024

Pull Request Test Coverage Report for Build 9219541970

Details

  • 23 of 49 (46.94%) changed or added relevant lines in 16 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 41.124%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/cli/src/commands/dev/watchPageFiles.ts 0 1 0.0%
packages/client/src/router/resolveRoutePath.ts 0 2 0.0%
packages/core/src/app/prepare/prepareRoutes.ts 0 2 0.0%
packages/client/src/router/resolveRouteFullPath.ts 0 3 0.0%
packages/client/src/setupGlobalComputed.ts 0 3 0.0%
packages/client/src/router/resolveRoute.ts 0 5 0.0%
packages/client/src/router/resolveRouteKey.ts 0 10 0.0%
Totals Coverage Status
Change from base Build 9211217292: -0.04%
Covered Lines: 695
Relevant Lines: 1729

💛 - Coveralls

@Mister-Hope
Copy link
Member Author

now e2e test is added in this PR

@Mister-Hope
Copy link
Member Author

image

A little weird to me, I can not reproduce the CI result locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug report] add extra pages seems to have no effect [Feature request] CleanUrl
4 participants