mirror of https://github.com/sveltejs/svelte
chore: simplify banner (#9246)
adds a new server route that contains banner data, that site-kit can read through its new banner components/helpers and display correctly --------- Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com> Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>pull/9815/head
parent
d5b237a887
commit
975904d9b7
@ -0,0 +1,29 @@
|
|||||||
|
import { json } from '@sveltejs/kit';
|
||||||
|
|
||||||
|
// This server route is used by all Svelte sites to load info about which banner to show.
|
||||||
|
// site-kit contains components/helpers to make fetching+displaying them easier.
|
||||||
|
export const GET = async () => {
|
||||||
|
return json(
|
||||||
|
/** @satisfies {Awaited<ReturnType<typeof import('@sveltejs/site-kit/components').fetchBanner>>} */ ([
|
||||||
|
{
|
||||||
|
id: 'advent2023',
|
||||||
|
start: new Date('1 Dec, 2023 00:00:00 UTC'),
|
||||||
|
end: new Date('24 Dec, 2024 23:59:59 UTC'),
|
||||||
|
arrow: true,
|
||||||
|
content: 'Svelte Advent 2023 is here!',
|
||||||
|
href: 'https://advent.sveltesociety.dev/'
|
||||||
|
},
|
||||||
|
|
||||||
|
// This one skips the blog post and just changes the link
|
||||||
|
{
|
||||||
|
id: 'advent2023-finished',
|
||||||
|
start: new Date('25 Dec, 2023 00:00:00 UTC'),
|
||||||
|
end: new Date('1 Jan, 2024 00:00:00 UTC'),
|
||||||
|
arrow: true,
|
||||||
|
content: 'Svelte Advent 2023 is over. See you next year!',
|
||||||
|
href: 'https://advent.sveltesociety.dev/'
|
||||||
|
// scope: ['svelte.dev, kit.svelte.dev'] // Dont show on learn.svelte.dev by not adding it to the array
|
||||||
|
}
|
||||||
|
])
|
||||||
|
);
|
||||||
|
};
|
Loading…
Reference in new issue