|
| 1 | +<script> |
| 2 | + import { onMount } from 'svelte'; |
| 3 | + import { goto } from '$app/navigation'; |
| 4 | + import { page } from '$app/stores'; |
| 5 | +
|
| 6 | + const docs = new Map([ |
| 7 | + ['if', ['{#if ...}', '/docs/svelte/if']], |
| 8 | + ['each', ['{#each ...}', '/docs/svelte/each']], |
| 9 | + ['await', ['{#key ...}', '/docs/svelte/await']], |
| 10 | + ['key', ['{#await ...}', '/docs/svelte/key']] |
| 11 | + ]); |
| 12 | +
|
| 13 | + function get_url_to_redirect_to() { |
| 14 | + const hash = $page.url.hash.slice(1); |
| 15 | + if (hash === '') return; |
| 16 | +
|
| 17 | + const new_docs = docs.get(hash); |
| 18 | + return new_docs && new_docs[1]; |
| 19 | + } |
| 20 | +
|
| 21 | + onMount(() => { |
| 22 | + const redirect = get_url_to_redirect_to(); |
| 23 | + if (redirect) { |
| 24 | + goto(redirect, { replaceState: true }); |
| 25 | + } |
| 26 | + }); |
| 27 | +</script> |
| 28 | + |
| 29 | +<svelte:head> |
| 30 | + <meta name="robots" content="noindex" /> |
| 31 | +</svelte:head> |
| 32 | + |
| 33 | +<div class="page"> |
| 34 | + <h1>This page no longer exists</h1> |
| 35 | + |
| 36 | + <h2>You may be looking for:</h2> |
| 37 | + |
| 38 | + <ul> |
| 39 | + {#each docs as doc} |
| 40 | + <li> |
| 41 | + <span style="font-weight:bold">{doc[1][0]}</span> is now located at |
| 42 | + <a href={doc[1][1]}>{doc[1][1]}</a> |
| 43 | + </li> |
| 44 | + {/each} |
| 45 | + </ul> |
| 46 | +</div> |
| 47 | + |
| 48 | +<style> |
| 49 | + .page { |
| 50 | + padding: var(--sk-page-padding-top) var(--sk-page-padding-side); |
| 51 | + max-width: var(--sk-page-content-width); |
| 52 | + box-sizing: content-box; |
| 53 | + margin: auto; |
| 54 | + text-wrap: balance; |
| 55 | + } |
| 56 | +
|
| 57 | + h1 { |
| 58 | + padding-bottom: 2rem; |
| 59 | + } |
| 60 | +
|
| 61 | + ul { |
| 62 | + list-style-type: none; |
| 63 | + } |
| 64 | +</style> |
0 commit comments