OpenGraph Image Hook
Set meta.image from an image field
Usage
import { openGraphImageHook } from '@adsign/payload-adsign-plugin';
export const Articles: CollectionConfig = {
fields: [
{
name: 'featuredImage',
type: 'upload',
relationTo: 'media',
},
],
hooks: {
afterRead: [
openGraphImageHook({
imageField: 'featuredImage',
}),
],
},
};How It Works
If meta.image is not set, the hook copies the value from the specified imageField to meta.image.
Options
| Option | Type | Description |
|---|---|---|
imageField | string | Field containing the image to use |