From 289c4ff18ae35b8051cc49c2a243bdb0acee49aa Mon Sep 17 00:00:00 2001 From: shiro Date: Thu, 4 Apr 2024 09:15:04 +0900 Subject: [PATCH] Fix SSR bugs --- src/components/SVG.tsx | 1 + src/ssg/getArticles.ssg.ts | 1 - src/style/fontFaces.tsx | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/SVG.tsx b/src/components/SVG.tsx index e5db481..e5824bc 100644 --- a/src/components/SVG.tsx +++ b/src/components/SVG.tsx @@ -54,6 +54,7 @@ function getInitialData(src: string, async?: boolean) { } else { // if (src.startsWith(config.resourceBaseURL)) // src = src.slice(config.resourceBaseURL.length); + if (src.startsWith(config.base)) src = src.slice(config.base.length); src = path.join(process.cwd(), "public", src); diff --git a/src/ssg/getArticles.ssg.ts b/src/ssg/getArticles.ssg.ts index 3688081..903f6f1 100644 --- a/src/ssg/getArticles.ssg.ts +++ b/src/ssg/getArticles.ssg.ts @@ -16,7 +16,6 @@ export const getArticlesSSG = () => { const title = frontmatter.title ?? raw.match(/# [^\n]*/)![0].slice(2); const description = raw.match(/# [^\n]+\n+([\s\S]+?)(?=\n\n)/)?.[1]; - console.log(description); const url = `/articles/${x.split(".")[0]}`; const date = x.split("-").slice(0, 3).reverse().join("."); diff --git a/src/style/fontFaces.tsx b/src/style/fontFaces.tsx index 9516ffc..769ec38 100644 --- a/src/style/fontFaces.tsx +++ b/src/style/fontFaces.tsx @@ -1,10 +1,12 @@ +import { config } from "~/config"; + type FontLoader = (font: string, format: string) => string; const japaneseCodeRange = (show: boolean) => show ? `unicode-range: U+3000-30FF , U+FF00-FFEF , U+4E00-9FAF ;` : ""; const nameSuffix = (isFull: boolean) => (isFull ? "" : " JP Only"); -const interPath = `/fonts/inter-3.19-roman/Inter`; +const interPath = `${config.base}/fonts/inter-3.19-roman/Inter`; // language=SCSS const notoFragments = (isFull: boolean, fontLoader?: FontLoader) => `