Skip to content

Commit 11322d5

Browse files
authored
redirect requests for playground to svelte.dev (#8)
1 parent 60a83fd commit 11322d5

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { redirect } from '@sveltejs/kit';
2+
3+
export function load({ url }) {
4+
redirect(301, `https://svelte.dev${url.pathname}`);
5+
}

apps/svelte.dev/src/routes/(authed)/playground/+page.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ export function load({ url }) {
1717
const q = new URLSearchParams();
1818
if (version) q.set('version', version);
1919
if (vim) q.set('vim', vim);
20-
redirect(301, `/playground/${id}?${q}`);
20+
redirect(301, `https://svelte.dev/playground/${id}?${q}`);
2121
}

apps/svelte.dev/src/routes/docs/+page.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@
8282
</p>
8383
</a>
8484

85-
<a href="/playground">
85+
<a href="https://svelte.dev/playground" class="external" target="_blank">
8686
<h2>とりあえず試してみたい方</h2>
8787
<p>
8888
Playground に移動し、example を確認したり、Svelte アプリをブラウザ上で作ったり、
8989
それを他の人にシェアすることができます。
9090
</p>
9191
</a>
9292

93-
<a href="/chat" class="external">
93+
<a href="/chat" class="external" target="_blank">
9494
<h2>助けて!行き詰まった!という方</h2>
9595
<p>
9696
私たちの Discord サーバーで他の Svelte ユーザーたちと一緒に過ごしたり、質問したりしましょう。

packages/site-kit/src/lib/nav/Nav.svelte

+10-6
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,16 @@ Top navigation bar for the application. It provides a slot for the left side, th
109109
{/snippet}
110110
</Dropdown>
111111
{:else}
112-
<a
113-
href="/{link.slug}"
114-
aria-current={$page.url.pathname.startsWith(`/${link.slug}`) ? 'page' : null}
115-
>
116-
{link.title}
117-
</a>
112+
{#if link.slug === 'playground'}
113+
<a href="https://svelte.dev/playground" target="_blank">{link.title}</a>
114+
{:else}
115+
<a
116+
href="/{link.slug}"
117+
aria-current={$page.url.pathname.startsWith(`/${link.slug}`) ? 'page' : null}
118+
>
119+
{link.title}
120+
</a>
121+
{/if}
118122
{/if}
119123
{/each}
120124
</div>

0 commit comments

Comments
 (0)