diff --git a/website/app/layout.tsx b/website/app/layout.tsx index 249325c5..c5a5ef5f 100644 --- a/website/app/layout.tsx +++ b/website/app/layout.tsx @@ -32,6 +32,10 @@ type LayoutProps = Readonly<{ }>; const RootLayout: FC = ({ children }) => { + // 根据环境设置字体路径前缀 + const isProduction = process.env.NODE_ENV === "production"; + const fontPrefix = isProduction ? "/qwen-code-docs" : ""; + return ( = ({ children }) => { saturation: { dark: 74, light: 74 }, }} /> - {children} + + {children} + ); }; diff --git a/website/mdx-components.tsx b/website/mdx-components.tsx index cbf38ed8..9f5c756b 100644 --- a/website/mdx-components.tsx +++ b/website/mdx-components.tsx @@ -8,8 +8,11 @@ import type { ImgHTMLAttributes } from "react"; // 自定义 img 组件,动态替换路径 const CustomImg = (props: ImgHTMLAttributes) => { const { src, ...rest } = props; - // 将 ../assets/ 替换为 /assets/ - const adjustedSrc = src?.replace(/\.\.\/assets\//, "/assets/"); + // 根据环境设置资源前缀 + const isProduction = process.env.NODE_ENV === "production"; + const assetPrefix = isProduction ? "/qwen-code-docs" : ""; + // 将 ../assets/ 替换为带前缀的 /assets/ + const adjustedSrc = src?.replace(/\.\.\/assets\//, `${assetPrefix}/assets/`); return ; }; diff --git a/website/public/Orbitron.zip b/website/public/Orbitron.zip deleted file mode 100644 index 57d9c12a..00000000 Binary files a/website/public/Orbitron.zip and /dev/null differ diff --git a/website/src/styles/globals.css b/website/src/styles/globals.css index 53f99c3c..02fc4e55 100644 --- a/website/src/styles/globals.css +++ b/website/src/styles/globals.css @@ -4,12 +4,13 @@ @source "../**/*.{ts,tsx}"; /* Terminal/Monospace Fonts */ -@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Fira+Code:wght@300..700&display=swap'); +@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Fira+Code:wght@300..700&display=swap"); /* Local Monoton Font */ @font-face { - font-family: 'Monoton'; - src: url('/Monoton/Monoton-Regular.ttf') format('truetype'); + font-family: "Monoton"; + src: url('var(--font-prefix, "")/Monoton/Monoton-Regular.ttf') + format("truetype"); font-weight: normal; font-style: normal; font-display: swap; @@ -17,56 +18,63 @@ /* Local Orbitron Font - Multiple Weights */ @font-face { - font-family: 'Orbitron'; - src: url('/Orbitron/Orbitron-VariableFont_wght.ttf') format('truetype-variations'); + font-family: "Orbitron"; + src: url('var(--font-prefix, "")/Orbitron/Orbitron-VariableFont_wght.ttf') + format("truetype-variations"); font-weight: 400 900; font-style: normal; font-display: swap; } @font-face { - font-family: 'Orbitron'; - src: url('/Orbitron/static/Orbitron-Regular.ttf') format('truetype'); + font-family: "Orbitron"; + src: url('var(--font-prefix, "")/Orbitron/static/Orbitron-Regular.ttf') + format("truetype"); font-weight: 400; font-style: normal; font-display: swap; } @font-face { - font-family: 'Orbitron'; - src: url('/Orbitron/static/Orbitron-Medium.ttf') format('truetype'); + font-family: "Orbitron"; + src: url('var(--font-prefix, "")/Orbitron/static/Orbitron-Medium.ttf') + format("truetype"); font-weight: 500; font-style: normal; font-display: swap; } @font-face { - font-family: 'Orbitron'; - src: url('/Orbitron/static/Orbitron-SemiBold.ttf') format('truetype'); + font-family: "Orbitron"; + src: url('var(--font-prefix, "")/Orbitron/static/Orbitron-SemiBold.ttf') + format("truetype"); font-weight: 600; font-style: normal; font-display: swap; } @font-face { - font-family: 'Orbitron'; - src: url('/Orbitron/static/Orbitron-Bold.ttf') format('truetype'); + font-family: "Orbitron"; + src: url('var(--font-prefix, "")/Orbitron/static/Orbitron-Bold.ttf') + format("truetype"); font-weight: 700; font-style: normal; font-display: swap; } @font-face { - font-family: 'Orbitron'; - src: url('/Orbitron/static/Orbitron-ExtraBold.ttf') format('truetype'); + font-family: "Orbitron"; + src: url('var(--font-prefix, "")/Orbitron/static/Orbitron-ExtraBold.ttf') + format("truetype"); font-weight: 800; font-style: normal; font-display: swap; } @font-face { - font-family: 'Orbitron'; - src: url('/Orbitron/static/Orbitron-Black.ttf') format('truetype'); + font-family: "Orbitron"; + src: url('var(--font-prefix, "")/Orbitron/static/Orbitron-Black.ttf') + format("truetype"); font-weight: 900; font-style: normal; font-display: swap; @@ -74,8 +82,14 @@ /* Terminal cursor animation */ @keyframes cursor-blink { - 0%, 50% { opacity: 1; } - 51%, 100% { opacity: 0; } + 0%, + 50% { + opacity: 1; + } + 51%, + 100% { + opacity: 0; + } } .terminal-cursor { @@ -83,20 +97,20 @@ } .terminal-text { - font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace; + font-family: "JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace; } .code-font { - font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace; + font-family: "JetBrains Mono", "Fira Code", "Consolas", "Monaco", monospace; } .monoton-font { - font-family: 'Monoton', monospace; + font-family: "Monoton", monospace; letter-spacing: 0.1em; } .orbitron-font { - font-family: 'Orbitron', sans-serif; + font-family: "Orbitron", sans-serif; letter-spacing: 0.05em; } @@ -115,7 +129,7 @@ /* Scanline effect for terminal aesthetic with purple tint */ .scanlines::before { - content: ''; + content: ""; position: absolute; top: 0; left: 0;