docs(faq): Solution to the problem of Github Pages (#223)

* docs(faq): Solution to the problem of Github Pages

* docs(faq): Change solution
This commit is contained in:
XieZongChen 2023-05-15 10:33:50 +08:00 committed by GitHub
parent 34dea5dc1f
commit 08bbd65007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 0 deletions

View File

@ -38,3 +38,36 @@ export default defineConfig({
}
})
```
## 部署到 Github Pages 后部分页面无法访问或 JS 路径找不到 {lang="zh-CN"}
## After deploying to Github Pages, some pages cannot be accessed or the JS path cannot be found {lang="en"}
::: zh-CN
Github Pages 默认使用 Jekyll 来构建静态站点,而 Jekyll 默认不会构建以 `_` 开头的文件或文件夹。
使用 Valaxy 构建后的产物可能会出现以 `_` 开头的文件,所以这种文件提交后会被 Jekyll 的构建忽略,从而导致问题发生。
实际上 Valaxy 构建后的产物可以直接用作静态站点,而不需要 Jekyll 构建这种多余的操作。
如果 Github Pages 所部署内容的根路径有名为 .nojekyll 的空文件,则会跳过 Jekyll 构建操作。
所以可以在项目的 `public` 文件夹内新建一个名为 `.nojekyll` 的文件:
:::
::: en
Github Pages uses Jekyll by default to build static sites, and Jekyll does not build files or folders that start with `_` by default.
The output of the Valaxy build may contain files that start with `_`, so these files will be ignored by Jekylls build after submission, causing problems.
In fact, the output of the Valaxy build can be used directly as a static site without the need for redundant Jekyll build operations.
If there is an empty file named .nojekyll in the root path of the content deployed by Github Pages, the Jekyll build operation will be skipped.
So you can create a new file named `.nojekyll` in the `public` folder of the project:
:::
```bash
|-- public
| |-- .nojekyll
```