allow for markdown on announcements

This commit is contained in:
Akis 2022-11-29 17:42:15 +02:00
parent 19da680ba0
commit 9f4ee858bd
Signed by untrusted user: akis
GPG Key ID: 267BF5C6677944ED
3 changed files with 10 additions and 4 deletions

View File

@ -1,8 +1,11 @@
import type { PageServerLoad } from "./$types"; import type { PageServerLoad } from "./$types";
import { compile } from "mdsvex";
export const load: PageServerLoad = async () => { export const load: PageServerLoad = async () => {
return { return {
state: await fetch("https://api.projectsegfau.lt/api/v1/state/announcements").then((res) => res.json()), state: await fetch("https://api.projectsegfau.lt/api/v1/state/announcements").then((res) => res.json()),
announcements: await fetch("https://api.projectsegfau.lt/api/v1/announcements").then((res) => res.json()) announcements: await fetch("https://api.projectsegfau.lt/api/v1/announcements").then((res) => res.json()),
content: await fetch("https://api.projectsegfau.lt/api/v1/announcements").then((res) => res.json()).then((res) => compile(res.title)).then((res) => res.code)
} }
} }

View File

@ -10,6 +10,7 @@
let announcements = data.announcements; let announcements = data.announcements;
let description: string = "Open source development and hosted services."; let description: string = "Open source development and hosted services.";
</script> </script>
<SvelteSeo title="Home | Project Segfault" {description} /> <SvelteSeo title="Home | Project Segfault" {description} />
@ -63,8 +64,10 @@
.format("DD/MM/YYYY HH:mm")} .format("DD/MM/YYYY HH:mm")}
</span> </span>
</div> </div>
<div class="title"> <div class="title">
<span class="text-xl font-semibold">{announcements.title}</span> <div class="text-xl font-semibold font-[var(--font-primary)]">{@html data.content}</div>
</div> </div>
{#if announcements.link} {#if announcements.link}

View File

@ -13,7 +13,7 @@
<meta name="description" content={description}> <meta name="description" content={description}>
</svelte:head> </svelte:head>
<h1>{title}</h1> <h1>Contact us</h1>
<span>{description}</span> <span>{description}</span>