Skip to content

Commit 48db8c1

Browse files
authored
fix: correct slugifyTitle hook example in documentation (#16306)
## 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:** ```ts const slug = value.toLowerCase()... return value // ← bug **Aftere:** ```ts const slug = value.toLowerCase()... return slug
1 parent 8fe5f04 commit 48db8c1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

docs/hooks/fields.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ const slugifyTitle: PostTitleHook = ({
292292
.replace(/[^\w\s-]/g, '')
293293
.replace(/\s+/g, '-')
294294

295-
return value
295+
return slug
296296
}
297297

298298
return value

0 commit comments

Comments
 (0)