defineOgImageComponent()

Define an og:image for the current page with type safety.

Introduction

The defineOgImageComponent() composable allows you to define an og:image using a custom template for the current page with improved type safety.

Arguments

defineOgImageComponent(
  component,
  props,
  options
)
  • component: The component to render as the og:image.
  • props: The props to pass to the component.
  • options: The options to use when generating the image. Same as the props for defineOgImage.

Example

export default defineOgImageComponent(
  // component
  'MyCustomComponent',
  // props
  {
    title: 'Welcome to my site!'
  },
  // options
  {
    fonts: [
      'CustomFont:400'
    ]
  }
)
Did this page help you?