redirect warning

This commit is contained in:
cupcakearmy 2020-11-02 15:55:45 +01:00
parent f1b3f1011b
commit fcf7907d16
No known key found for this signature in database
GPG Key ID: D28129AE5654D9D9

View File

@ -1,6 +1,9 @@
<script context="module"> <script context="module">
export async function preload() { export async function preload(page) {
return this.fetch('/api/posts.json').then((res) => res.json()) return {
...(await this.fetch('/api/posts.json').then((res) => res.json())),
redirected: page.query.old !== undefined,
}
} }
</script> </script>
@ -9,13 +12,31 @@
import PostPreview from '../../components/PostPreview.svelte' import PostPreview from '../../components/PostPreview.svelte'
export let data export let data
export let redirected
</script> </script>
<style>
div {
margin-bottom: 6em;
background-color: var(--clr-error);
padding: 1em;
}
</style>
<svelte:head> <svelte:head>
<title>Blog</title> <title>Blog</title>
</svelte:head> </svelte:head>
<SimplePage title="Blog"> <SimplePage title="Blog">
{#if redirected}
<div>
<h2>You have been redirected 🔄</h2>
<p>
Probably you are coming form my old blog (blog.nicco.io)
<br />
The article you were looking for is down here 👇
</p>
</div>
{/if}
{#each data as post} {#each data as post}
<PostPreview {post} /> <PostPreview {post} />
{/each} {/each}