mirror of
https://github.com/LukeHagar/sveltekit-og.git
synced 2025-12-06 12:47:49 +00:00
pages cfw
This commit is contained in:
@@ -19,19 +19,7 @@ const template = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
const fontFile = await fetch('https://og-playground.vercel.app/inter-latin-ext-400-normal.woff');
|
|
||||||
const fontData: ArrayBuffer = await fontFile.arrayBuffer();
|
|
||||||
|
|
||||||
export const GET: RequestHandler = async () => {
|
export const GET: RequestHandler = async () => {
|
||||||
return ImageResponse(template, {
|
return ImageResponse(template);
|
||||||
height: 400,
|
|
||||||
width: 800,
|
|
||||||
fonts: [
|
|
||||||
{
|
|
||||||
name: 'Inter',
|
|
||||||
data: fontData,
|
|
||||||
weight: 400
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,23 +2,9 @@ import OG from './OG.svelte';
|
|||||||
import type { RequestHandler } from '@sveltejs/kit';
|
import type { RequestHandler } from '@sveltejs/kit';
|
||||||
import { componentToImageResponse } from '@ethercorps/sveltekit-og';
|
import { componentToImageResponse } from '@ethercorps/sveltekit-og';
|
||||||
|
|
||||||
const fontFile = await fetch('https://og-playground.vercel.app/inter-latin-ext-700-normal.woff');
|
|
||||||
const fontData: ArrayBuffer = await fontFile.arrayBuffer();
|
|
||||||
|
|
||||||
export const GET: RequestHandler = async () => {
|
export const GET: RequestHandler = async () => {
|
||||||
return componentToImageResponse(
|
return componentToImageResponse(
|
||||||
OG,
|
OG,
|
||||||
{ text: 'Ready to dive in?', spanText: 'Start your free trial today.' },
|
{ text: 'Ready to dive in?', spanText: 'Start your free trial today.' }
|
||||||
{
|
|
||||||
height: 250,
|
|
||||||
width: 500,
|
|
||||||
fonts: [
|
|
||||||
{
|
|
||||||
name: 'Inter Latin',
|
|
||||||
data: fontData,
|
|
||||||
weight: 700
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user