Skip to content

Commit

Permalink
fix: check alternative url href exists
Browse files Browse the repository at this point in the history
Fixes #142
  • Loading branch information
harlan-zw committed Sep 27, 2023
1 parent a726bab commit 802597d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/runtime/sitemap/entries/normalise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@ export async function normaliseSitemapData(data: SitemapEntryInput[], options: B
if (e.alternatives) {
e.alternatives = mergeOnKey(e.alternatives.map((e) => {
const a: AlternativeEntry & { key?: string } = { ...e }
a.href = resolve(typeof a.href === 'string' ? a.href : a.href.href)
// string
if (typeof a.href === 'string')
a.href = resolve(a.href)
// URL object
else if (typeof a.href === 'object' && a.href)
a.href = resolve(a.href.href)
return a
}), 'hreflang')
}
Expand Down

0 comments on commit 802597d

Please sign in to comment.