Skip to content

Commit

Permalink
Fix: canonical should allow relative urls
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Feb 28, 2023
1 parent 11494c3 commit 0ba6474
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/next/src/lib/metadata/resolvers/resolve-basics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ export const resolveAlternates: FieldResolverWithMetadataBase<'alternates'> = (
) => {
if (!alternates) return null
const result: ResolvedAlternateURLs = {
canonical: resolveUrl(alternates.canonical, metadataBase),
canonical: metadataBase
? resolveUrl(alternates.canonical, metadataBase)
: alternates.canonical || null,
languages: null,
media: null,
types: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,12 @@ export type AlternateURLs = {
}

export type ResolvedAlternateURLs = {
canonical: null | URL
canonical: null | string | URL
languages: null | Languages<null | URL>
media: null | {
[media: string]: null | URL
[media: string]: null | string | URL
}
types: null | {
[types: string]: null | URL
[types: string]: null | string | URL
}
}

0 comments on commit 0ba6474

Please sign in to comment.