From c2b78bef69a9eb5b739ef05e1c42b9574d78d54d Mon Sep 17 00:00:00 2001 From: RhenCloud Date: Sun, 2 Aug 2026 07:51:50 +0800 Subject: [PATCH] feat(web): link landing docs button to the docs site Point the homepage Documentation card at the hosted docs site (https://webhooker.docs.worldexecute.me), language-aware: /zh for Chinese and / for English. Still overridable via DOCS_URL. --- src/home-routes.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/home-routes.ts b/src/home-routes.ts index e76edba..c5f0e16 100644 --- a/src/home-routes.ts +++ b/src/home-routes.ts @@ -4,6 +4,7 @@ import type { Env } from "./types"; type Lang = "zh" | "en"; const DEFAULT_REPO = "https://github.com/ReCloudStudio/WebHooker"; +const DEFAULT_DOCS = "https://webhooker.docs.worldexecute.me"; function pickLang(raw: string | undefined): Lang { return raw === "en" ? "en" : "zh"; @@ -33,10 +34,11 @@ function icon(name: string): string { return `${paths[name] ?? ""}`; } -function layout(lang: Lang, repo: string, docs: string): string { +function layout(lang: Lang, repo: string, docsBase: string): string { const t = (zh: string, en: string): string => (lang === "zh" ? zh : en); const q = (p: string): string => `${p}?lang=${lang}`; const altLang: Lang = lang === "zh" ? "en" : "zh"; + const docs = lang === "zh" ? `${docsBase}/zh` : `${docsBase}/`; const items: LinkItem[] = [ { @@ -183,8 +185,8 @@ export function createHomeRoutes(): Hono<{ Bindings: Env }> { app.get("/", (c) => { const lang = pickLang(c.req.query("lang")); const repo = c.env.GITHUB_REPO_URL ?? DEFAULT_REPO; - const docs = c.env.DOCS_URL ?? `${repo}#readme`; - return c.html(layout(lang, repo, docs)); + const docsBase = (c.env.DOCS_URL ?? DEFAULT_DOCS).replace(/\/+$/, ""); + return c.html(layout(lang, repo, docsBase)); }); return app;