From a34edbbe3e8052315512c9004d1554666b144fae Mon Sep 17 00:00:00 2001 From: Jon McClure Date: Fri, 26 Aug 2022 17:37:50 +0100 Subject: [PATCH] SEO default location for origin --- src/components/SEO/SEO.svelte | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/SEO/SEO.svelte b/src/components/SEO/SEO.svelte index b33c403c..da6f994f 100644 --- a/src/components/SEO/SEO.svelte +++ b/src/components/SEO/SEO.svelte @@ -80,6 +80,9 @@ try { return new URL(baseUrl).origin; } catch { + // This handles a weird case where Vite's base path is + // reset to './' after the app hydrates... + if (typeof window !== 'undefined') return getOrigin(window.location.href); return ''; } };