forked from sveltejs/svelte.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: redirect logic-blocks page (sveltejs#629)
* chore: redirect logic-blocks page * refactor into reusable component * tweak * simplify * simplify --------- Co-authored-by: Rich Harris <[email protected]>
- Loading branch information
1 parent
7b942ae
commit 5877aed
Showing
3 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<script lang="ts"> | ||
import { goto } from '$app/navigation'; | ||
import { Text } from '@sveltejs/site-kit/components'; | ||
interface Props { | ||
docs: Map<string, string[]>; | ||
} | ||
const { docs }: Props = $props(); | ||
$effect(() => { | ||
const hash = location.hash.slice(1); | ||
if (hash === '') return; | ||
const new_docs = docs.get(hash); | ||
if (new_docs) { | ||
goto(new_docs[1], { replaceState: true }); | ||
} | ||
}); | ||
</script> | ||
|
||
<svelte:head> | ||
<meta name="robots" content="noindex" /> | ||
</svelte:head> | ||
|
||
<div class="page"> | ||
<header> | ||
<h1>This page no longer exists</h1> | ||
</header> | ||
|
||
<Text> | ||
<p>You may be looking for one of the following:</p> | ||
|
||
<ul> | ||
{#each docs.values() as [title, href]} | ||
<li> | ||
<span style="font-weight:bold">{title}</span> is now | ||
<a {href}>here</a> | ||
</li> | ||
{/each} | ||
</ul> | ||
</Text> | ||
</div> | ||
|
||
<style> | ||
.page { | ||
padding: var(--sk-page-padding-top) var(--sk-page-padding-side) var(--sk-page-padding-bottom); | ||
max-width: var(--sk-page-content-width); | ||
box-sizing: content-box; | ||
margin: auto; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script> | ||
import RemovedPage from '../RemovedPage.svelte'; | ||
const docs = new Map([ | ||
['if', ['{#if ...}', '/docs/svelte/if']], | ||
['each', ['{#each ...}', '/docs/svelte/each']], | ||
['await', ['{#key ...}', '/docs/svelte/await']], | ||
['key', ['{#await ...}', '/docs/svelte/key']] | ||
]); | ||
</script> | ||
|
||
<RemovedPage {docs} /> |