Skip to content

Commit a8e3fda

Browse files
committed
Merge remote-tracking branch 'origin/main' into wip
2 parents d7400e9 + a51a135 commit a8e3fda

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

website/src/components/templates/BaseTemplate.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Style, css } from "hono/css";
22
import { html } from "hono/html";
33
import type { FC, PropsWithChildren } from "hono/jsx";
4-
import { basePath } from "../../metadata";
4+
import { basePath, originUrl, typstOfficialUrl } from "../../metadata";
55
import type { Page } from "../../types/model";
66
import { getTranslationStatus } from "../../utils/translationStatus";
77
import {
@@ -44,6 +44,9 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
4444
const route = page.route;
4545
const outline = page.outline;
4646
const translationStatus = getTranslationStatus(route);
47+
const absoluteRouteUrl = new URL(route, originUrl).toString();
48+
const faviconUrl = new URL(`${basePath}/favicon.png`, originUrl).toString();
49+
const typstOfficialRouteUrl = new URL(route, typstOfficialUrl).toString();
4750
return (
4851
<html lang="ja" class="scroll-pt-24">
4952
<head>
@@ -52,26 +55,20 @@ export const BaseTemplate: FC<BaseTemplateProps> = ({
5255
<meta name="description" content={description} />
5356
<meta name="viewport" content="width=device-width,initial-scale=1" />
5457
<meta name="theme-color" content="#239dad" />
55-
<meta
56-
property="og:url"
57-
content={`https://typst-jp.github.io${route}`}
58-
/>
58+
<meta property="og:url" content={absoluteRouteUrl} />
5959
<meta
6060
property="og:title"
6161
content={`${title} – Typstドキュメント日本語版`}
6262
/>
6363
<meta property="og:site_name" content="Typst" />
6464
<meta property="og:description" content={description} />
6565
<meta property="og:type" content="" />
66-
<meta
67-
property="og:image"
68-
content="https://typst-jp.github.io/assets/favicon.png"
69-
/>
66+
<meta property="og:image" content={faviconUrl} />
7067
<meta property="og:image:width" content="1200" />
7168
<meta property="og:image:height" content="630" />
7269
<meta name="twitter:site" content="@typstapp" />
7370
<meta name="twitter:card" content="summary_large_image" />
74-
<link rel="canonical" href={`https://typst-jp.github.io${route}`} />
71+
<link rel="canonical" href={absoluteRouteUrl} />
7572
<meta name="robots" content="index, follow" />
7673
<meta
7774
name="twitter:image:alt"
@@ -247,7 +244,7 @@ samp {
247244
{translationStatus !== "community" && (
248245
<div class="flex">
249246
<a
250-
href={`https://typst.app${route}`}
247+
href={typstOfficialRouteUrl}
251248
target="_blank"
252249
rel="noopener noreferrer"
253250
class="inline-flex items-center text-sm underline text-gray-400 hover:text-gray-600 transition-colors"
@@ -266,7 +263,7 @@ samp {
266263

267264
{translationStatus !== "community" && (
268265
<a
269-
href={`https://typst.app${route}`}
266+
href={typstOfficialRouteUrl}
270267
target="_blank"
271268
rel="noopener noreferrer"
272269
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"

website/vite.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import devServer from "@hono/vite-dev-server";
77
import ssg from "@hono/vite-ssg";
88
import tailwindcss from "@tailwindcss/vite";
99
import { defineConfig } from "vite";
10-
import { basePath } from "./src/metadata";
10+
import { basePath, originUrl } from "./src/metadata";
1111

1212
// typst-docsが生成したドキュメントのアセットをassets/にシンボリックリンクする
1313
const assetsDocsPath = resolve(__dirname, "../assets/docs/");
@@ -20,11 +20,11 @@ const ssgPlugins =
2020
basePath === "/"
2121
? [
2222
sitemapPlugin({
23-
baseUrl: "https://typst-jp.github.io/",
23+
baseUrl: originUrl,
2424
}),
2525
robotsTxtPlugin({
2626
rules: [{ userAgent: "*", allow: ["/"] }],
27-
sitemapUrl: "https://typst-jp.github.io/sitemap.xml",
27+
sitemapUrl: new URL("sitemap.xml", originUrl).href,
2828
}),
2929
]
3030
: [];

0 commit comments

Comments
 (0)