1
1
import type { FC , PropsWithChildren } from "hono/jsx" ;
2
+ import { baseUrl , typstOfficialUrl } from "../../metadata" ;
2
3
import type { Page } from "../../types/model" ;
3
4
import { getTranslationStatus } from "../../utils/translationStatus" ;
4
5
import {
@@ -41,6 +42,9 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
41
42
const route = page . route ;
42
43
const outline = page . outline ;
43
44
const translationStatus = getTranslationStatus ( route ) ;
45
+ const absoluteRouteUrl = new URL ( route , baseUrl ) . toString ( ) ;
46
+ const faviconUrl = new URL ( "/assets/favicon.png" , baseUrl ) . toString ( ) ;
47
+ const typstOfficialRouteUrl = new URL ( route , typstOfficialUrl ) . toString ( ) ;
44
48
return (
45
49
< html lang = "ja" class = "scroll-pt-24" >
46
50
< head >
@@ -49,26 +53,20 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
49
53
< meta name = "description" content = { description } />
50
54
< meta name = "viewport" content = "width=device-width,initial-scale=1" />
51
55
< meta name = "theme-color" content = "#239dad" />
52
- < meta
53
- property = "og:url"
54
- content = { `https://typst-jp.github.io${ route } ` }
55
- />
56
+ < meta property = "og:url" content = { absoluteRouteUrl } />
56
57
< meta
57
58
property = "og:title"
58
59
content = { `${ title } – Typstドキュメント日本語版` }
59
60
/>
60
61
< meta property = "og:site_name" content = "Typst" />
61
62
< meta property = "og:description" content = { description } />
62
63
< meta property = "og:type" content = "" />
63
- < meta
64
- property = "og:image"
65
- content = "https://typst-jp.github.io/assets/favicon.png"
66
- />
64
+ < meta property = "og:image" content = { faviconUrl } />
67
65
< meta property = "og:image:width" content = "1200" />
68
66
< meta property = "og:image:height" content = "630" />
69
67
< meta name = "twitter:site" content = "@typstapp" />
70
68
< meta name = "twitter:card" content = "summary_large_image" />
71
- < link rel = "canonical" href = { `https://typst-jp.github.io ${ route } ` } />
69
+ < link rel = "canonical" href = { absoluteRouteUrl } />
72
70
< meta name = "robots" content = "index, follow" />
73
71
< link rel = "sitemap" type = "application/xml" href = "/sitemap.xml" />
74
72
< meta
@@ -184,7 +182,7 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
184
182
{ translationStatus !== "community" && (
185
183
< div class = "flex" >
186
184
< a
187
- href = { `https://typst.app ${ route } ` }
185
+ href = { typstOfficialRouteUrl }
188
186
target = "_blank"
189
187
rel = "noopener noreferrer"
190
188
class = "inline-flex items-center text-sm underline text-gray-400 hover:text-gray-600 transition-colors"
@@ -203,7 +201,7 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
203
201
204
202
{ translationStatus !== "community" && (
205
203
< a
206
- href = { `https://typst.app ${ route } ` }
204
+ href = { typstOfficialRouteUrl }
207
205
target = "_blank"
208
206
rel = "noopener noreferrer"
209
207
class = "group inline-flex items-center px-3 py-2 rounded-md border border-gray-200 bg-white hover:border-gray-500 hover:bg-gray-50 transition-all duration-200 w-fit"
0 commit comments