70d3293251
新增 SITE 配置(url/email/telegram/line/store),Footer、Pricing、astro.config (canonical 域名)均改为引用它;改联系方式/域名只动一处。 astro.config.mjs 直接 import 该 TS(Astro 配置加载支持)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
// @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 || SITE.url;
|
||
|
||
export default defineConfig({
|
||
site: SITE_URL,
|
||
output: 'static',
|
||
trailingSlash: 'always',
|
||
build: {
|
||
// 内联样式/脚本会破坏严格 CSP(script-src/style-src 'self'),全部产出为独立资源文件。
|
||
inlineStylesheets: 'never',
|
||
assets: '_astro',
|
||
},
|
||
integrations: [react()],
|
||
vite: {
|
||
build: {
|
||
// 关闭 JS 内联,保证 script-src 'self' 严格 CSP 下可运行。
|
||
assetsInlineLimit: 0,
|
||
},
|
||
},
|
||
});
|