-
-
Notifications
You must be signed in to change notification settings - Fork 635
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
fix: uppercase in path #2170
fix: uppercase in path #2170
Conversation
β Deploy Preview for nuxt-content canceled.Built without sensitive environment variables
|
That's great. Can you add this option to the docs too? Also, I don't really think, that this is a breaking change. So I think that it does not have to be in the experimental features. What do you think? |
β Live Preview ready!
|
β Live Preview ready!
|
You are right, I moved this option and added the documentation! Thanks for the continued follow up. |
src/module.ts
Outdated
* | ||
* @default false | ||
*/ | ||
keepUppercase: boolean |
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 name may be too vague since we do not understand it's related to path.
Maybe something like respectPathCase, when false, it lower case or respectFilenameCase
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.
I've rename the name to respectPathCase
.
Co-authored-by: nobkd <[email protected]>
@@ -410,3 +410,10 @@ Toggles the document-driven mode. | |||
| `layoutFallbacks` | `string[]` | A list of `globals` key to use to find a layout fallback. | | |||
| `injectPage` | `boolean` | Inject `[...slug].vue` pre-configured page | | |||
| `trailingSlash` | `boolean` | Add a slash at the end of `canonical` and `og:url` | | |||
|
|||
## `respectPathCase` |
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.
Maybe you could provide an example to help dev to understand types of issues that this option can solve
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.
Added!
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.
Perfect π
Nice PR! |
β¦ntent into feat/allow-uppercase-in-path
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.
Perfect π
Thanks β€οΈ
@@ -67,7 +67,8 @@ const isPartial = (path: string): boolean => path.split(/[:/]/).some(part => par | |||
* @returns generated slug | |||
*/ | |||
export const generatePath = (path: string, { forceLeadingSlash = true } = {}): string => { | |||
path = path.split('/').map(part => slugify(refineUrlPart(part), { lower: true })).join('/') | |||
const { content } = useRuntimeConfig().public |
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.
We should avoid using Nuxt generated helpers (like useRuntimeConfig
) in transformers. Transformers and in general the content parser could be able to work outside of Nuxt Context.
There is already several usecases of parser outside of Nuxt.
respectPathCase
could be passed in second argumant of this function and transformer itseld
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.
I see, I've now moved it into the options of the transformer.
π Linked issue
close #2162
β Type of change
π Description
Currently, if we construct a path like /zh-CN/foo.md, the corresponding document cannot be found. This is because the path is automatically converted to lowercase. I think the existence of such a path is reasonable and should not be converted. I don't understand why this is done, so in order not to introduce destructive changes, I added a flag named keepUppercase to allow uppercase letters in the path.
I wasn't sure where this flag should be placed, so I tentatively put it under the experimental options.
Resolves #2162
π Checklist