aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-09 17:16:50 -0500
committermat <github@matdoes.dev>2022-04-09 17:16:50 -0500
commitf3abc77ac9333ee115704645437511baacee85e8 (patch)
tree5e2a15a3d535a0055de69b44f1aabb85bdb42778
parent16403a7d834bbe1f2f4dddf8791baa8a1163222b (diff)
downloadskyblock-stats-f3abc77ac9333ee115704645437511baacee85e8.tar.gz
skyblock-stats-f3abc77ac9333ee115704645437511baacee85e8.tar.bz2
skyblock-stats-f3abc77ac9333ee115704645437511baacee85e8.zip
don't lazy load collapsible leaderboard sections
improves seo and stuff
-rw-r--r--src/lib/Collapsible.svelte15
-rw-r--r--src/routes/leaderboards/index.svelte2
2 files changed, 11 insertions, 6 deletions
diff --git a/src/lib/Collapsible.svelte b/src/lib/Collapsible.svelte
index 615f9ce..e1f28b2 100644
--- a/src/lib/Collapsible.svelte
+++ b/src/lib/Collapsible.svelte
@@ -9,6 +9,7 @@
let open: boolean
export let id: string | undefined = undefined
+ export let lazy = true
function checkHash() {
if (id && id === location.hash.slice(1)) {
@@ -27,15 +28,19 @@
</slot>
</summary>
<div>
- <!--
+ {#if lazy}
+ <!--
We do this so images and other things inside the content are not
loaded until it's open.
For some reason browsers don't handle this, although they should.
-->
- <noscript>
- <slot />
- </noscript>
- {#if open}
+ <noscript>
+ <slot />
+ </noscript>
+ {#if open}
+ <slot />
+ {/if}
+ {:else}
<slot />
{/if}
</div>
diff --git a/src/routes/leaderboards/index.svelte b/src/routes/leaderboards/index.svelte
index 02360fb..7c81ff7 100644
--- a/src/routes/leaderboards/index.svelte
+++ b/src/routes/leaderboards/index.svelte
@@ -34,7 +34,7 @@
{#each Object.entries(data) as [category, leaderboards]}
<section>
- <Collapsible id={category}>
+ <Collapsible id={category} lazy={false}>
<ul>
{#each leaderboards as leaderboard}
{@const imageUrl = leaderboard.startsWith('collection_')