Skip to content

Commit

Permalink
fix: Refactor MultiMeta component to handle string and URL contents
Browse files Browse the repository at this point in the history
  • Loading branch information
tuber committed Jul 25, 2024
1 parent d4eb89d commit 9a80ac9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/next/src/lib/metadata/generate/meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ export function MultiMeta({
if (typeof contents === 'undefined' || contents === null) {
return null
}
if (!Array.isArray(contents)) {
contents = [contents]
}

return MetaFilter(
contents.map((content) => {
Expand Down
5 changes: 5 additions & 0 deletions packages/next/src/lib/metadata/resolvers/resolve-opengraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ export const resolveOpenGraph: FieldResolverExtraArgs<
)
}

/*
warning: force type assertion maybe merge authors of openGraph with string type from Metadata into ResolvedOpenGraph,
but it's not support a string type for authors of openGraph.
is there any other field that has the same issue?
*/
const resolved = {
...openGraph,
title: resolveTitle(openGraph.title, titleTemplate),
Expand Down

0 comments on commit 9a80ac9

Please sign in to comment.