From 70d3293251662b67128adf11dd97d889442034b6 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Sun, 5 Jul 2026 19:23:19 +0800 Subject: [PATCH] =?UTF-8?q?refactor(website):=20=E5=9F=9F=E5=90=8D/?= =?UTF-8?q?=E9=82=AE=E7=AE=B1/=E6=B8=A0=E9=81=93=E6=94=B6=E5=8F=A3?= =?UTF-8?q?=E5=88=B0=20src/config/site.ts=20=E5=8D=95=E4=B8=80=E7=9C=9F?= =?UTF-8?q?=E7=9B=B8=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增 SITE 配置(url/email/telegram/line/store),Footer、Pricing、astro.config (canonical 域名)均改为引用它;改联系方式/域名只动一处。 astro.config.mjs 直接 import 该 TS(Astro 配置加载支持)。 Co-Authored-By: Claude Opus 4.8 --- web/website/astro.config.mjs | 3 ++- web/website/src/components/Footer.astro | 9 +++++---- web/website/src/components/Pricing.astro | 7 ++++--- web/website/src/config/site.ts | 22 ++++++++++++++++++++++ 4 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 web/website/src/config/site.ts diff --git a/web/website/astro.config.mjs b/web/website/astro.config.mjs index 668f3ad..b514bb8 100644 --- a/web/website/astro.config.mjs +++ b/web/website/astro.config.mjs @@ -1,13 +1,14 @@ // @ts-check import { defineConfig } from 'astro/config'; import react from '@astrojs/react'; +import { SITE } from './src/config/site.ts'; // 纯静态站点 (SSG),零 SSR。 // `site` 仅用于生成绝对 URL(sitemap / canonical),镜像部署时可被任意域名覆盖, // 不影响「整站可秒级复制到任意备用域名」:产物为纯相对路径静态文件。 // 主站 canonical 域名。镜像构建务必用「同一个」SITE_URL,使 canonical 始终指向主站 // (避免镜像与主站 SEO 竞争),且主站/镜像产物 hash 完全一致(验收:内容一致性)。 -const SITE_URL = process.env.SITE_URL || 'https://pangolin.yanmeiai.com'; +const SITE_URL = process.env.SITE_URL || SITE.url; export default defineConfig({ site: SITE_URL, diff --git a/web/website/src/components/Footer.astro b/web/website/src/components/Footer.astro index b616026..24c53f2 100644 --- a/web/website/src/components/Footer.astro +++ b/web/website/src/components/Footer.astro @@ -1,6 +1,7 @@ --- import Brand from './Brand.astro'; import type { T } from '../i18n/strings'; +import { SITE } from '../config/site'; interface Props { t: T } const { t } = Astro.props; @@ -34,10 +35,10 @@ const { t } = Astro.props;

{t('ft.contact')}

diff --git a/web/website/src/components/Pricing.astro b/web/website/src/components/Pricing.astro index a8886f1..a9ee142 100644 --- a/web/website/src/components/Pricing.astro +++ b/web/website/src/components/Pricing.astro @@ -2,6 +2,7 @@ import Icon from './Icon.astro'; import PricingPlans from './PricingPlans.jsx'; import { PRICES, type T, type Lang } from '../i18n/strings'; +import { SITE } from '../config/site'; interface Props { t: T; lang: Lang } const { t, lang } = Astro.props; @@ -82,9 +83,9 @@ function cell(v: string) {
{t('pay.store')} {t('pay.usdt')} - Telegram @pangolin_app - LINE @pangolinvpn - pangolin@yanmeiai.com + Telegram {SITE.telegram.handle} + LINE {SITE.line.handle} + {SITE.email}
diff --git a/web/website/src/config/site.ts b/web/website/src/config/site.ts new file mode 100644 index 0000000..15205ec --- /dev/null +++ b/web/website/src/config/site.ts @@ -0,0 +1,22 @@ +/** + * site.ts — 站点级配置「单一真相源」:域名、联系方式、对外渠道。 + * + * 改这一处即可:组件(Footer / Pricing)与 astro.config 的 canonical 域名都从这里读。 + * 此处只承载「事实值」(URL / 邮箱 / handle);可翻译的展示文案仍走 i18n/strings.ts。 + */ +export const SITE = { + /** canonical 主域名。镜像部署可用 SITE_URL 环境变量覆盖(见 astro.config.mjs)。 */ + url: 'https://pangolin.yanmeiai.com', + + /** 联系邮箱。Cloudflare Email Routing 转发到个人 Gmail。 */ + email: 'pangolin@yanmeiai.com', + + /** Telegram 公开频道(群为私有,公开页不放)。 */ + telegram: { handle: '@pangolin_app', url: 'https://t.me/pangolin_app' }, + + /** LINE 官方账号 —— 待确认(#24)。 */ + line: { handle: '@pangolinvpn' }, + + /** 自助发卡商店 —— 占位待定(#24)。 */ + store: { label: 'shop.pangolin.vpn' }, +} as const;