Files
Jiwon ChoiandGitHub 2bd27e72e5 fix(next): Metadata.openGraph values not resolving basic values when type is set (#63620)
### What?

The string value of `Metadata.openGraph.emails` throws error:

```tsx
export const metadata = {
  openGraph: {
    type: 'article',
    emails: '[email protected]',
  },
};
```

Error:

```sh
r.map is not a function
```

The type is:

```tsx
type OpenGraphMetadata = {
  // ...
  emails?: string | Array<string>
}
```

### Why?

Basic values such as `emails` and `phoneNumbers` were not included when
`ogType` was set while resolving the values.

### How?

Include basic values when resolving the metadata.

Fixes #63415
2024-04-15 21:17:48 +02:00

20 lines
534 B
TypeScript

import type { Metadata } from 'next'
export default function Layout({ children }) {
return children
}
export const metadata = {
openGraph: {
title: 'Layout open graph title',
description: 'My custom description',
type: 'article',
publishedTime: '2023-01-01T00:00:00.000Z',
authors: ['author1', 'author2', 'author3'],
images: new URL('https://example.com/og-image.jpg'),
emails: '[email protected]',
phoneNumbers: '1234567890',
faxNumbers: '1234567890',
} satisfies Metadata['openGraph'],
}