Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/svelte.dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"@codemirror/search": "^6.5.2",
"@codemirror/state": "^6.2.1",
"@codemirror/view": "^6.17.1",
"@fontsource/roboto-mono": "^5.0.8",
"@jridgewell/sourcemap-codec": "^1.4.15",
"@lezer/common": "^1.0.4",
"@lezer/highlight": "^1.1.6",
Expand Down
8 changes: 3 additions & 5 deletions apps/svelte.dev/src/routes/blog/[slug]/card.png/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import { read } from '$app/server';
import satori from 'satori';
import { html as toReactNode } from 'satori-html';
import Card from './Card.svelte';
// @ts-expect-error no types for the query exist
import CardCSS from './Card.svelte?raw&svelte&type=style';
import OverpassRegular from './Overpass-Regular.ttf?url';
import YantramanavRegular from './Yantramanav-Regular.ttf?url';
import { blog_posts } from '$lib/server/content';

export const prerender = true;
Expand All @@ -20,15 +18,15 @@ export function entries() {

const height = 630;
const width = 1200;
const data = await read(OverpassRegular).arrayBuffer();
const data = await read(YantramanavRegular).arrayBuffer();

export async function GET({ params }) {
const post = blog_posts.find((post) => post.slug === `blog/${params.slug}`);

if (!post) error(404);

const result = render(Card, { props: { title: post.metadata.title, date: post.date_formatted } });
const element = toReactNode(`${result.body}<style>${CardCSS}</style>`);
const element = toReactNode(`<head>${result.head}</head>${result.body}`);

const svg = await satori(element, {
fonts: [
Expand Down
4 changes: 3 additions & 1 deletion apps/svelte.dev/src/routes/blog/[slug]/card.png/Card.svelte
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<svelte:options css="injected" />

<script lang="ts">
let { title, date }: { title: string; date: string } = $props();
</script>
Expand All @@ -16,7 +18,7 @@
display: flex;
width: 100%;
height: 100%;
font-family: 'Overpass';
font-family: 'Yantramanav';
background: white;
}

Expand Down
Binary file not shown.
8 changes: 0 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading