FAQ
改变构建形式
Change Generated Directory Style
Valaxy 默认将 xxx.md
构建为 /xxx.html
。
如果您更希望默认构建为 /xxx/index.html
的形式。
可以修改 vite-ssg
的配置。
在用户目录下的 vite.config.ts
中设置:
Valaxy builds xxx.md
as /xxx.html
by default.
If you prefer to build them as /xxx/index.html
, you can modify the configuration of vite-ssg
.
Set it in vite.config.ts
under the user directory as follows:
import { defineConfig } from 'vite'
export default defineConfig({
// ...
ssgOptions: {
dirStyle: 'nested',
}
})
部署到 Github Pages 后部分页面无法访问或 JS 路径找不到
After deploying to Github Pages, some pages cannot be accessed or the JS path cannot be found
Github Pages 默认使用 Jekyll 来构建静态站点,而 Jekyll 默认不会构建以 _
开头的文件或文件夹。
使用 Valaxy 构建后的产物可能会出现以 _
开头的文件,所以这种文件提交后会被 Jekyll 的构建忽略,从而导致问题发生。
实际上 Valaxy 构建后的产物可以直接用作静态站点,而不需要 Jekyll 构建这种多余的操作。
如果 Github Pages 所部署内容的根路径有名为 .nojekyll 的空文件,则会跳过 Jekyll 构建操作。
所以可以在项目的 public
文件夹内新建一个名为 .nojekyll
的文件:
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 Jekyll’s 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:
|-- public
| |-- .nojekyll
显示的文章创建/修改时间不正确
The displayed article creation/modification time is incorrect
根据这份 YAML
规范,符合 ISO 8601
标准的时间格式都会被解析为 Date
类型,且不显式标注时区的时间戳都会作 UTC 处理。
但是为了方便写作与从其他框架迁移,我们将未显式标注时区的时间戳解析为系统时区对应的时间(即 2024-07-06 12:00:00
在 Asia/Shanghai
下会解析 为 2024-07-06T12:00:00+08:00
)。
无论如何,我们建议显式添加时区信息,例如:
date: 2024-07-06 12:00:00 +8
如果你不喜欢显式标记,请务必在构建前指定系统时区:
sudo timedatectl set-timezone Asia/Shanghai
这样就能正确解析为 UTC+8 时区的 2024-07-06 12:00:00
。
主题作者也能通过在 scaffolds/post.md
中使用 date: <%=date%> +8
来实现这一点。
According to this YAML
specification, time formats that conform to the ISO 8601
standard will be parsed as Date
type, and timestamps without explicitly marked time zones will be treated as UTC.
However, for the convenience of writing and migrating from other frameworks, we parse timestamps without explicitly marked timezones under system timezone (i.e., 2024-07-06 12:00:00
will be parsed as 2024-07-06T12:00:00+08:00
in Asia/Shanghai
).
If you don’t like explicit marking, be sure to specify the system time zone before building:
sudo timedatectl set-timezone Asia/Shanghai
Nevertheless, we recommend explicitly adding time zone information, for example:
date: 2024-07-06 12:00:00 +8
This way, it can be correctly parsed as 2024-07-06 12:00:00
in the UTC+8 time zone.
Theme authors can also achieve this by using date: <%=date%> +8
in scaffolds/post.md
.
To Be Continued.