closes #3... again but with try/catching on URL

This commit is contained in:
Jon McClure 2022-08-26 14:12:44 +01:00
parent ea05e47eaa
commit 7bb5df698a
2 changed files with 10 additions and 2 deletions

View file

@ -10,7 +10,7 @@
import {
withComponentDocs,
withStoryDocs
withStoryDocs,
} from '$lib/docs/utils/withParams.js';
const meta = {

View file

@ -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