Skip to content

Commit fd8fa9a

Browse files
committed
fix: 修复无法正确获取 IS_CHINA_SITE 环境变量
修复浏览 `/services` 页面时无法获取 NodeJS的 process 从而无法正确获取 IS_CHINA_SITE 环境变量,参考 https://docusaurus.io/docs/deployment#using-environment-variables
1 parent 7ccd963 commit fd8fa9a

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,5 @@
8686
"engines": {
8787
"node": ">=18.0"
8888
},
89-
"packageManager": "pnpm@10.12.1"
89+
"packageManager": "pnpm@10.24.0+sha512.01ff8ae71b4419903b65c60fb2dc9d34cf8bb6e06d03bde112ef38f7a34d6904c424ba66bea5cdcf12890230bf39f9580473140ed9c946fef328b6e5238a345a"
9090
}

src/components/GlobalContent.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import React from "react";
22
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
33

4-
const IS_CHINA_SITE = process.env.CHINA === "true";
5-
64
/**
7-
* A component that conditionally renders its children based on the CHINA environment variable.
8-
* If CHINA is 'true', the children (typically Markdown content) will not be rendered.
5+
* A component that conditionally renders its children based on the `IS_CHINA_SITE` environment variable.
6+
* If `IS_CHINA_SITE` is 'true', the children (typically Markdown content) will not be rendered.
97
*/
108
export default function GlobalContent({ children }) {
11-
if (IS_CHINA_SITE) {
12-
return null; // Do not render children if in China site context
9+
if (useDocusaurusContext().siteConfig.customFields.IS_CHINA_SITE) {
10+
return null; // Do not render children if in the China site context
1311
}
1412
return <>{children}</>; // Render children otherwise
1513
}

0 commit comments

Comments
 (0)