Commit 1d12bb9

HPCesia <me@hpcesia.com>
2026-03-12 03:51:29
Fix assets base path
1 parent a7b21e0
Changed files (2)
src
src/integrations/extract-image.ts
@@ -5,6 +5,7 @@ import { z } from "astro/zod";
 import { defineIntegration } from "astro-integration-kit";
 import * as cheerio from "cheerio";
 import { getBase64ImageInfo } from "../utils/image.js";
+import { url } from "../utils/url.js";
 
 // TODO: After Typst 0.15 published, use jsx and path to auto optimize images in typst
 // See https://github.com/typst/typst/pull/7555
@@ -70,7 +71,7 @@ export const extractImage = defineIntegration({
                     }
                   }
 
-                  $(el).attr("src", `/${options.dir}/${filename}`);
+                  $(el).attr("src", url(`/${options.dir}/${filename}`));
                   htmlChanged = true;
                 }
 
src/layouts/GlobalLayout.astro
@@ -26,8 +26,8 @@ const {
     <meta name="viewport" content="width=device-width" />
     <meta name="generator" content={Astro.generator} />
 
-    <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
-    <link rel="icon" href="/favicon.ico" />
+    <link rel="icon" type="image/svg+xml" href={url("/favicon.svg")} />
+    <link rel="icon" href={url("/favicon.ico")} />
 
     <title>{title}</title>
     <meta name="title" content={title} />