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">
export async function preload() {
return this.fetch('/api/posts.json').then((res) => res.json())
export async function preload(page) {
return {
...(await this.fetch('/api/posts.json').then((res) => res.json())),
redirected: page.query.old !== undefined,
}
}
</script>
@ -9,13 +12,31 @@
import PostPreview from '../../components/PostPreview.svelte'
export let data
export let redirected
</script>
<style>
div {
margin-bottom: 6em;
background-color: var(--clr-error);
padding: 1em;
}
</style>
<svelte:head>
<title>Blog</title>
</svelte:head>
<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}
<PostPreview {post} />
{/each}