@@ -3,6 +3,7 @@ import { html } from "hono/html";
33import type { FC , PropsWithChildren } from "hono/jsx" ;
44import { basePath , originUrl , typstOfficialUrl } from "../../metadata" ;
55import type { Page } from "../../types/model" ;
6+ import { joinPath } from "../../utils/path" ;
67import { getTranslationStatus } from "../../utils/translationStatus" ;
78import {
89 CaretRightCircleIcon ,
@@ -78,41 +79,53 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
7879 rel = "icon"
7980 type = "image/png"
8081 sizes = "32x32"
81- href = { ` ${ basePath . replace ( / \/ $ / , "" ) } /favicon.png` }
82+ href = { joinPath ( basePath , "/favicon.png" ) }
8283 />
8384 < link
8485 rel = "preload"
85- href = { `${ basePath . replace ( / \/ $ / , "" ) } /fonts/hanken-grotesk/HKGrotesk-Regular.woff2` }
86+ href = { joinPath (
87+ basePath ,
88+ "/fonts/hanken-grotesk/HKGrotesk-Regular.woff2" ,
89+ ) }
8690 as = "font"
8791 type = "font/woff2"
8892 crossOrigin = "anonymous"
8993 />
9094 < link
9195 rel = "preload"
92- href = { `${ basePath . replace ( / \/ $ / , "" ) } /fonts/hanken-grotesk/HKGrotesk-Bold.woff2` }
96+ href = { joinPath (
97+ basePath ,
98+ "/fonts/hanken-grotesk/HKGrotesk-Bold.woff2" ,
99+ ) }
93100 as = "font"
94101 type = "font/woff2"
95102 crossOrigin = "anonymous"
96103 />
97104 < link
98105 rel = "preload"
99- href = { `${ basePath . replace ( / \/ $ / , "" ) } /fonts/hanken-grotesk/HKGrotesk-SemiBold.woff2` }
106+ href = { joinPath (
107+ basePath ,
108+ "/fonts/hanken-grotesk/HKGrotesk-SemiBold.woff2" ,
109+ ) }
100110 as = "font"
101111 type = "font/woff2"
102112 crossOrigin = "anonymous"
103113 />
104114 < link
105115 rel = "preload"
106- href = { `${ basePath . replace ( / \/ $ / , "" ) } /fonts/cascadia-code/CascadiaMono-Regular-Sub.woff2` }
116+ href = { joinPath (
117+ basePath ,
118+ "/fonts/cascadia-code/CascadiaMono-Regular-Sub.woff2" ,
119+ ) }
107120 as = "font"
108121 type = "font/woff2"
109122 crossOrigin = "anonymous"
110123 />
111124 < link
112125 href = {
113126 import . meta. env . DEV
114- ? ` ${ basePath . replace ( / \/ $ / , "" ) } /src/globals.css`
115- : ` ${ basePath . replace ( / \/ $ / , "" ) } /globals.css`
127+ ? joinPath ( basePath , "/src/globals.css" )
128+ : joinPath ( basePath , "/globals.css" )
116129 }
117130 rel = "stylesheet"
118131 />
@@ -124,7 +137,7 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
124137/* Global font family */
125138@font-face {
126139 font-family: "HK Grotesk";
127- src: url("${ basePath . replace ( / \/ $ / , "" ) } /fonts/hanken-grotesk/HKGrotesk-Regular.woff2")
140+ src: url("${ joinPath ( basePath , "/fonts/hanken-grotesk/HKGrotesk-Regular.woff2" ) } ")
128141 format("woff2");
129142 font-weight: 400;
130143 font-style: normal;
@@ -133,7 +146,7 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
133146
134147@font-face {
135148 font-family: "HK Grotesk";
136- src: url("${ basePath . replace ( / \/ $ / , "" ) } /fonts/hanken-grotesk/HKGrotesk-SemiBold.woff2")
149+ src: url("${ joinPath ( basePath , "/fonts/hanken-grotesk/HKGrotesk-SemiBold.woff2" ) } ")
137150 format("woff2");
138151 font-weight: 600;
139152 font-style: normal;
@@ -142,15 +155,15 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
142155
143156@font-face {
144157 font-family: "HK Grotesk";
145- src: url("${ basePath . replace ( / \/ $ / , "" ) } /fonts/hanken-grotesk/HKGrotesk-Bold.woff2") format("woff2");
158+ src: url("${ joinPath ( basePath , "/fonts/hanken-grotesk/HKGrotesk-Bold.woff2" ) } ") format("woff2");
146159 font-weight: 700;
147160 font-style: normal;
148161 font-display: swap;
149162}
150163
151164@font-face {
152165 font-family: "Cascadia Mono";
153- src: url("${ basePath . replace ( / \/ $ / , "" ) } /fonts/cascadia-code/CascadiaMono-Regular-Sub.woff2")
166+ src: url("${ joinPath ( basePath , "/fonts/cascadia-code/CascadiaMono-Regular-Sub.woff2" ) } ")
154167 format("woff2");
155168 font-weight: 400;
156169 font-style: normal;
@@ -176,7 +189,7 @@ samp {
176189 { import . meta. env . DEV &&
177190 html `
178191 < script >
179- import ( "${ basePath . replace ( / \/ $ / , "" ) } /@vite/client" )
192+ import ( "${ joinPath ( basePath , "/@vite/client" ) } " )
180193 </ script >
181194 ` }
182195 </ head >
0 commit comments