diff --git a/src/components/SEO/SEO.stories.svelte b/src/components/SEO/SEO.stories.svelte index a411537c..15a22844 100644 --- a/src/components/SEO/SEO.stories.svelte +++ b/src/components/SEO/SEO.stories.svelte @@ -10,7 +10,7 @@ import { withComponentDocs, - withStoryDocs + withStoryDocs, } from '$lib/docs/utils/withParams.js'; const meta = { diff --git a/src/components/SEO/SEO.svelte b/src/components/SEO/SEO.svelte index ab3e3e45..b33c403c 100644 --- a/src/components/SEO/SEO.svelte +++ b/src/components/SEO/SEO.svelte @@ -76,7 +76,15 @@ */ export let includeAnalytics: boolean = false; - $: origin = new URL(baseUrl).origin; + const getOrigin = (baseUrl) => { + try { + return new URL(baseUrl).origin; + } catch { + return ''; + } + }; + + $: origin = getOrigin(baseUrl); $: canonicalUrl = origin + pageUrl.pathname; // Only fire analytics on prod sites