Skip to content

fix: correct slugifyTitle hook example in documentation#16306

Merged
paulpopus merged 1 commit intopayloadcms:mainfrom
AntonAmbarov:main
Apr 19, 2026
Merged

fix: correct slugifyTitle hook example in documentation#16306
paulpopus merged 1 commit intopayloadcms:mainfrom
AntonAmbarov:main

Conversation

@AntonAmbarov
Copy link
Copy Markdown
Contributor

What?

Fixed incorrect return statement in the slugifyTitle field hook example in the official documentation.

The example was generating a properly formatted slug but then incorrectly returning the original value instead of the slugified result.

Why?

This was a bug in the documentation that could mislead developers implementing automatic slug generation. The hook appeared to work, but in reality did nothing useful.

How?

  • Changed return value to return slug in the example

Before/After

Before:

const slug = value.toLowerCase()... 
return value // ← bug

**Aftere:**
```ts
const slug = value.toLowerCase()... 
return slug

- Fixed incorrect return statement in slugifyTitle example
- Now properly returns generated slug instead of original value
@AntonAmbarov AntonAmbarov changed the title fix(docs): correct slugifyTitle hook example in documentation fix: correct slugifyTitle hook example in documentation Apr 17, 2026
@paulpopus paulpopus enabled auto-merge (squash) April 19, 2026 19:40
@paulpopus paulpopus self-assigned this Apr 19, 2026
@paulpopus paulpopus merged commit 48db8c1 into payloadcms:main Apr 19, 2026
21 of 22 checks passed
Giorgiosaud added a commit to BePartnerLabs/payload that referenced this pull request Apr 20, 2026
fix: correct slugifyTitle hook example in documentation (payloadcms#16306)
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.

2 participants