-
Notifications
You must be signed in to change notification settings - Fork 3k
feat: support custom slugify functions #14117
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
base: main
Are you sure you want to change the base?
Conversation
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
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.
Pull Request Overview
This PR adds support for custom slugify functions to the slug field, allowing developers to override the default slugify behavior with their own implementation. This enables special character handling, additional language support, and integration with third-party slugify libraries.
- Added a
slugifyparameter toSlugFieldArgstype andslugFieldfunction - Modified
generateSlugto accept and use custom slugify functions - Updated documentation to describe the new
slugifyoption
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/payload/src/fields/baseFields/slug/index.ts | Exports SlugFieldArgs type, adds slugify parameter to field configuration |
| packages/payload/src/fields/baseFields/slug/generateSlug.ts | Updates generateSlug to accept and use custom slugify function parameter |
| docs/fields/text.mdx | Documents the new slugify configuration option in the slug field table |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Continuation of #14007.
Supports overriding the default slugify function of the slug field. This is necessary if the slug requires special treatment, such as character encoding, additional language support, etc.
For example, if you wanted to use the
slugifypackage, you could do something like this:Todo: