Skip to content

Commit 2bc54bb

Browse files
committed
fix: update navigation links to use base path for routing 🌐
1 parent 6e39f11 commit 2bc54bb

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

β€Žexample/example-website/src/routes/+layout.svelteβ€Ž

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<script lang="ts">
22
import '../app.css';
33
import { page } from '$app/state';
4+
import { base } from '$app/paths';
45
import { onMount } from 'svelte';
56
67
let { children } = $props();
78
let mobileMenuOpen = $state(false);
89
910
const navigation = [
10-
{ name: 'Home', href: '/' },
11-
{ name: 'Features', href: '/features' },
12-
{ name: 'Demo', href: '/demo' },
11+
{ name: 'Home', href: base || '/' },
12+
{ name: 'Features', href: `${base}/features` },
13+
{ name: 'Demo', href: `${base}/demo` },
1314
{
1415
name: 'Documentation',
1516
href: 'https://pub.dev/documentation/dart_imagehash/latest/',
@@ -389,7 +390,7 @@
389390
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
390391
<div class="flex h-16 items-center justify-between">
391392
<div class="flex items-center">
392-
<a href="/" class="gradient-text text-2xl font-bold"> dart_imagehash </a>
393+
<a href={base || '/'} class="gradient-text text-2xl font-bold"> dart_imagehash </a>
393394
</div>
394395

395396
<!-- Desktop Navigation -->

β€Žexample/example-website/src/routes/+page.svelteβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import { onMount } from 'svelte';
3+
import { base } from '$app/paths';
34
45
let isVisible = $state(false);
56
@@ -82,7 +83,7 @@
8283
Get Started
8384
</a>
8485
<a
85-
href="/demo"
86+
href="{base}/demo"
8687
class="rounded-lg border border-white/20 bg-white/10 px-8 py-3 font-semibold text-white backdrop-blur-sm transition-all duration-300 hover:bg-white/20"
8788
>
8889
Try Demo

β€Žexample/example-website/src/routes/demo/+page.svelteβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import { onMount } from 'svelte';
2+
import { base } from '$app/paths';
33
</script>
44

55
<svelte:head>
@@ -40,7 +40,7 @@
4040
Perfect for understanding how each algorithm works.
4141
</p>
4242
<a
43-
href="/demo/basic"
43+
href="{base}/demo/basic"
4444
class="inline-block rounded-lg bg-gradient-to-r from-purple-600 to-blue-600 px-6 py-3 font-semibold text-white shadow-lg transition-all duration-300 hover:from-purple-700 hover:to-blue-700"
4545
>
4646
Try Basic Demo
@@ -63,7 +63,7 @@
6363
Python implementations. Great for understanding real-world applications.
6464
</p>
6565
<a
66-
href="/demo/github-icons"
66+
href="{base}/demo/github-icons"
6767
class="inline-block rounded-lg bg-gradient-to-r from-green-600 to-teal-600 px-6 py-3 font-semibold text-white shadow-lg transition-all duration-300 hover:from-green-700 hover:to-teal-700"
6868
>
6969
View GitHub Icons Demo

β€Žexample/example-website/src/routes/demo/basic/+page.svelteβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import dartData from '$lib/data/basic-demo-dart.json';
33
import pythonData from '$lib/data/basic-demo-python.json';
44
import type { Algorithms } from '$lib/types';
5+
import { base } from '$app/paths';
56
67
let selectedAlgorithm = $state<Algorithms>('ahash');
78
let selectedImage1 = $state('');
@@ -134,7 +135,7 @@
134135
<div class="relative mb-6">
135136
<div class="absolute -top-12 right-0 sm:-top-8 md:-top-6">
136137
<a
137-
href="/demo"
138+
href="{base}/demo"
138139
class="rounded-lg border border-white/20 bg-white/10 px-3 py-1.5 text-xs text-white transition-all hover:bg-white/20 sm:px-4 sm:py-2 sm:text-sm"
139140
>
140141
← Back to Demo Selection

β€Žexample/example-website/src/routes/demo/github-icons/+page.svelteβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import dartHashes from '$lib/data/github-icons-dart.json';
33
import pythonHashes from '$lib/data/github-icons-python.json';
44
import type { AlgorithmsWithZ } from '$lib/types';
5+
import { base } from '$app/paths';
56
67
let selectedAlgorithm: AlgorithmsWithZ = $state('ahash');
78
let isLoading = $state(false);
@@ -108,7 +109,7 @@
108109
<div class="relative mb-6">
109110
<div class="absolute -top-12 right-0 sm:-top-8 md:-top-6">
110111
<a
111-
href="/demo"
112+
href="{base}/demo"
112113
class="rounded-lg border border-white/20 bg-white/10 px-3 py-1.5 text-xs text-white transition-all hover:bg-white/20 sm:px-4 sm:py-2 sm:text-sm"
113114
>
114115
← Back to Demo Selection

0 commit comments

Comments
Β (0)