From dc3323b5741845ac6109781da32d34f16e925815 Mon Sep 17 00:00:00 2001 From: Akihiro Saiki Date: Sun, 5 Jan 2025 02:45:53 +0900 Subject: [PATCH] chore: use Google Fonts API v2 to get fonts for ogp (#1705) --- quartz/util/og.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/quartz/util/og.tsx b/quartz/util/og.tsx index 0430a26..42b9b27 100644 --- a/quartz/util/og.tsx +++ b/quartz/util/og.tsx @@ -35,7 +35,9 @@ export async function getSatoriFont(headerFontName: string, bodyFontName: string async function fetchTtf(fontName: string, weight: FontWeight): Promise { try { // Get css file from google fonts - const cssResponse = await fetch(`https://fonts.googleapis.com/css?family=${fontName}:${weight}`) + const cssResponse = await fetch( + `https://fonts.googleapis.com/css2?family=${fontName}:wght@${weight}`, + ) const css = await cssResponse.text() // Extract .ttf url from css file