Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanoverna committed Nov 20, 2024
1 parent 84b9337 commit 80d8510
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/pages/og-image/doc-page.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import type { APIRoute } from 'astro';
import { readFile } from 'node:fs/promises';
import { dirname, resolve } from 'node:path';
import satori from 'satori';
import { html } from 'satori-html';
import sharp from 'sharp';
import css from 'style-object-to-css-string';
import { fileURLToPath } from 'url';
import FullLogo from './_resources/logo.svg?raw';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

export const GET: APIRoute = async ({ url }) => {
const colfaxBold = await readFile(
resolve(__dirname, '../../../public/fonts/colfax-web-700.woff'),
const colfaxBold = await fetch(new URL('/fonts/colfax-web-700.woff', url)).then((res) =>
res.arrayBuffer(),
);

const title = url.searchParams.get('title') || 'General Concepts';
Expand Down Expand Up @@ -92,7 +86,7 @@ export const GET: APIRoute = async ({ url }) => {
fonts: [
{
name: 'colfaxBold',
data: colfaxBold,
data: Buffer.from(colfaxBold, 'utf8'),
style: 'normal',
weight: 500,
},
Expand Down

0 comments on commit 80d8510

Please sign in to comment.