Skip to content

Commit 4672e00

Browse files
feat(layout): add (back) navigation buttons, change redirection
1 parent 8bbba99 commit 4672e00

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/routes/+layout.svelte

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,25 @@
133133
<span class="text-xl font-semibold">Blog</span>
134134
{/if}
135135

136+
<!-- Navigation -->
137+
{#if !page.route.id?.startsWith("/blog")}
138+
<ul class="ml-6 hidden sm:flex">
139+
{#each [{ link: "/package/svelte", title: "Home" }, { link: "/packages", title: "Packages" }, { link: "/blog", title: "Blog" }] as { link, title } (link)}
140+
{@const disabled = page.url.pathname.startsWith(link)}
141+
<li>
142+
<Button
143+
href={disabled ? undefined : link}
144+
variant="ghost"
145+
class="hover:bg-accent/75"
146+
{disabled}
147+
>
148+
{title}
149+
</Button>
150+
</li>
151+
{/each}
152+
</ul>
153+
{/if}
154+
136155
<!-- Right part -->
137156
<div class="flex flex-1 items-center justify-end space-x-2 sm:space-x-4">
138157
<nav class="flex items-center space-x-1">

src/routes/blog/+page.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { redirect } from "@sveltejs/kit";
22

33
export function load() {
4-
redirect(307, "/");
4+
redirect(307, "/blog/v2");
55
}

0 commit comments

Comments
 (0)