-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Issue
The OG image URL generation in contentlayer.config.ts has invalid JavaScript syntax that will cause runtime errors.
Location: contentlayer.config.ts:48-50
Current Code (Broken)
image: {
type: 'string',
resolve: (doc) =>
`https://seanoliver.dev/api/og?title=${
(doc.title.split(' '), join('+'))
}`,
},Problem
The syntax (doc.title.split(' '), join('+')) uses the comma operator incorrectly:
doc.title.split(' ')creates an array but the result is discarded- The comma operator evaluates both expressions but only returns the second
join('+')is called without context (not on the array), causing a ReferenceError
This would fail with: ReferenceError: join is not defined
Expected Fix
Should use method chaining:
image: {
type: 'string',
resolve: (doc) =>
`https://seanoliver.dev/api/og?title=${doc.title.split(' ').join('+')}`,
},Context
Discovered during RSS feed PR (#7) code review, but intentionally left out of scope to maintain PR focus on RSS functionality only.
Labels
- bug
- contentlayer
- og-images
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels