fix(core): page creation should respect page options#1673
Open
Mister-Hope wants to merge 3 commits intomainfrom
Open
fix(core): page creation should respect page options#1673Mister-Hope wants to merge 3 commits intomainfrom
Mister-Hope wants to merge 3 commits intomainfrom
Conversation
Pull Request Test Coverage Report for Build 21566506449Details
💛 - Coveralls |
There was a problem hiding this comment.
Pull request overview
This PR fixes page creation to properly respect the path option in pageOptions, ensuring correct locale and language resolution. Previously, when an explicit path was provided via options.path, the inferPagePath function would ignore it and only use the file path, leading to incorrect locale inference.
Changes:
- Modified
inferPagePathto check and useoptions.pathfirst before falling back to file-based inference - Updated
createPageto pass theoptionsparameter toinferPagePath - Updated all test calls to
inferPagePathto include the new requiredoptionsparameter
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/core/src/page/inferPagePath.ts | Added logic to check options.path first and resolve locale from it before falling back to file-based path inference |
| packages/core/src/page/createPage.ts | Updated call to inferPagePath to pass the options parameter |
| packages/core/tests/page/inferPagePath.spec.ts | Added empty options: {} parameter to all test calls for inferPagePath |
| packages/core/tests/page/createPage.spec.ts | Updated expectation for pathInferred from null to '/' for pages created with explicit path |
Comments suppressed due to low confidence (1)
packages/core/src/page/inferPagePath.ts:11
- The function documentation should be updated to reflect the new behavior. The comment currently states "Infer page path according to file path" but the function now also handles explicit paths from
options.path. Consider updating the documentation to something like "Infer or resolve page path from options or file path" to accurately reflect that it can return an explicitly provided path rather than just inferring from the file path.
/**
* Infer page path according to file path
*
* @internal
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
meteorlxy
reviewed
Feb 9, 2026
|
|
||
| // infer page path according to file path | ||
| const { pathInferred, pathLocale } = inferPagePath({ app, filePathRelative }) | ||
| const { pathInferred, pathLocale } = inferPagePath({ |
Member
There was a problem hiding this comment.
As inferPagePath is to infer page path and locale, maybe we could update to something like that:
const { pathInferred, pathInferredLocale } = inferPagePath({ app, filePathRelative });
const pathLocale = resolvePagePathLocale({ pathInferredLocale, options });Any thoughts?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See vuepress-theme-hope/vuepress-theme-hope#5193
vuepress-theme-hope/vuepress-theme-hope#5188
Basically,
createPageshall respectpathin pageOptions, giving correct pageLocale and lang