closes #3... again but with try/catching on URL
This commit is contained in:
parent
ea05e47eaa
commit
7bb5df698a
2 changed files with 10 additions and 2 deletions
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
import {
|
import {
|
||||||
withComponentDocs,
|
withComponentDocs,
|
||||||
withStoryDocs
|
withStoryDocs,
|
||||||
} from '$lib/docs/utils/withParams.js';
|
} from '$lib/docs/utils/withParams.js';
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,15 @@
|
||||||
*/
|
*/
|
||||||
export let includeAnalytics: boolean = false;
|
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;
|
$: canonicalUrl = origin + pageUrl.pathname;
|
||||||
|
|
||||||
// Only fire analytics on prod sites
|
// Only fire analytics on prod sites
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue