diff --git a/src/app.html b/src/app.html index 6052660..77a5ff5 100644 --- a/src/app.html +++ b/src/app.html @@ -8,7 +8,5 @@
%sveltekit.body%
- - diff --git a/src/routes/Header.svelte b/src/routes/Header.svelte index 26c7682..bc7ed2d 100644 --- a/src/routes/Header.svelte +++ b/src/routes/Header.svelte @@ -9,9 +9,21 @@ import List from 'phosphor-svelte/lib/List'; import { afterNavigate } from '$app/navigation'; - onMount(() => { + function loadPagefind() { // @ts-ignore new PagefindUI({ element: '#search', showSubResults: true }); + } + + onMount(() => { + try { + console.debug('Pagefind loaded, not waiting'); + loadPagefind(); + console.debug('Pagefind not loaded, waiting for DOMContentLoaded'); + } catch (e) { + window.addEventListener('DOMContentLoaded', () => { + loadPagefind(); + }); + } }); let expanded = false; @@ -21,6 +33,11 @@ }); + + + + +