Skip to content

Commit

Permalink
Fix title not correct on navigate
Browse files Browse the repository at this point in the history
When navigating to another route, the title was not updated.
  • Loading branch information
MatthiasKunnen committed Jan 14, 2024
1 parent 86ad48d commit 4047f29
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 13 deletions.
8 changes: 0 additions & 8 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@
};
</script>

<svelte:head>
{#if typeof $page.data.title === 'string'}
<title>{$page.data.title + ' | IcarusPedia'}</title>
{:else}
<title>IcarusPedia</title>
{/if}
</svelte:head>

<div class="body">
<div class="root-content" bind:this={rootContent}>
<slot></slot>
Expand Down
3 changes: 3 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<script lang="ts">
import Logo from '$lib/Logo.svelte';
</script>
<svelte:head>
<title>IcarusPedia</title>
</svelte:head>

<div class="home-content">
<div class="logo">
Expand Down
1 change: 0 additions & 1 deletion src/routes/Crafters/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ export const load = async () => {
.sort(([, a], [, b]) => {
return a.displayName.localeCompare(b.displayName);
}),
title: 'Crafters',
};
};
3 changes: 3 additions & 0 deletions src/routes/Crafters/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
export let data;
</script>
<svelte:head>
<title>Crafters | IcarusPedia</title>
</svelte:head>

<h1>Crafters</h1>

Expand Down
1 change: 0 additions & 1 deletion src/routes/Crafters/[crafter]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ export const load = async ({params}) => {
return {
crafter: crafter,
recipes: crafter.recipes.map(r => getRecipe(r, data)),
title: crafter.displayName,
};
};
3 changes: 3 additions & 0 deletions src/routes/Crafters/[crafter]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
export let data;
</script>
<svelte:head>
<title>Crafter {data.crafter.displayName} | IcarusPedia</title>
</svelte:head>

<a href="/Crafters">&lt; See all crafters</a>
<h1>{data.crafter.displayName}</h1>
Expand Down
1 change: 0 additions & 1 deletion src/routes/Items/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ export const load = async () => {
.sort(([, a], [, b]) => {
return a.displayName.localeCompare(b.displayName);
}),
title: 'Items',
};
};
3 changes: 3 additions & 0 deletions src/routes/Items/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
export let data;
</script>
<svelte:head>
<title>Craftable Items | IcarusPedia</title>
</svelte:head>

<h1>All Craftable Icarus Items</h1>
<p>Other lists of Icarus items:</p>
Expand Down
1 change: 0 additions & 1 deletion src/routes/Items/All/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ export const load = async () => {
.sort(([, a], [, b]) => {
return a.displayName.localeCompare(b.displayName);
}),
title: 'Items',
};
};
4 changes: 4 additions & 0 deletions src/routes/Items/All/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
</script>

<svelte:head>
<title>All Items | IcarusPedia</title>
</svelte:head>

<h1>All Icarus Items</h1>
<p>
This includes items that are experimental and not craftable. For a list of craftable items, go
Expand Down
1 change: 0 additions & 1 deletion src/routes/Items/Item/[item]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const load = async ({params}) => {
modifier: itemModifier,
recipes: item.recipes.map(r => getRecipe(r, data)),
stats: itemStats,
title: item.displayName,
};
};

Expand Down
4 changes: 4 additions & 0 deletions src/routes/Items/Item/[item]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
export let data;
</script>

<svelte:head>
<title>{data.item.displayName} | IcarusPedia</title>
</svelte:head>

<a href="/Items">&lt; See all items</a>
<h1>{data.item.displayName}</h1>
<div class="icon">
Expand Down

0 comments on commit 4047f29

Please sign in to comment.