Migrate from Hexo to Valaxy

迁移步骤

Migration Steps

迁移内容

Migrate Contents

Hexo 博客目录与 Valaxy 博客目录对应关系如下,将相关内容复制至对应文件夹即可。

譬如迁移文章,即将 Hexo source/_posts 目录下内容复制至 Valaxy pages/posts 目录下。

用途HexoValaxy
文章(Markdown 文件)source/_postspages/posts
页面(Markdown / Html)sourcepages
静态资源(*.js / *.css / CNAME etc.)sourcepublic

The relationship between Hexo blog directory and Valaxy blog directory is shown in the table below. Just copy the relevant contents to the corresponding folder.

For example: To migrate articles, just copy files from Hexo's source/_posts to Valaxy's pages/posts directory.

ContentsHexoValaxy
Posts (Markdown files)source/_postspages/posts
Pages (Markdown / Html files)sourcepages
Static assets (*.js / *.css / CNAME etc.)sourcepublic

迁移配置

Migrate Configurations

参考 Valaxy 配置文档 将 Hexo _config.yml 配置文件中的内容,迁移至 valaxy.config.ts 文件中。

配置示例:demo/yun/valaxy.config.tsyunyoujun.github.io/valaxy.config.ts
valaxy.config.ts 提供了完备的类型提示,这意味着你在 VSCode 中可以直接鼠标悬浮查看各参数注释。

Refer to Valaxy Config to migrate configurations from Hexo's _config.yml to Valaxy's valaxy.config.ts.

Examples of configuration: demo/yun/valaxy.config.ts, yunyoujun.github.io/valaxy.config.ts.
valaxy.config.ts provides a complete type prompt, which means that you can hover on configuration fields directly to view the comments in VSCode.

示例

Example

更复杂的迁移示例,您还可以对比 yunyoujun.github.io | GitHub 仓库 hexo 分支与 valaxy 的异同。

For more complex migration examples, you can also compare hexo branch and valaxy branch in yunyoujun.github.io | GitHub to see the similarities and differences.

常见问题

Common Problems

摘要截断符

Read More Separator

默认为 <!-- more -->more 前后需有空格。

Default to <-- More -->, there are spaces before and after more.

Markdown 换行

Newline in Markdown

Valaxy 的 Markdown 解析基于 markdown-it 实现。

markdown-it 的策略在 Markdown 中换行后渲染的内容并没有换行:

第一行
没有换行

第一行 没有换行


如果需要正常换行,需在末尾添加两个空格:

第一行(末尾有两个空格)  
换行了

第一行(末尾有两个空格)
换行了

Markdown rendering in Valaxy is based on markdown-it.

The default strategy of markdown-it does not wrap the rendered content when wrapping in Markdown:

first line
second line but not wrapped

first line second line but not wrapped


If you want to move the second line to a new line, add two spaces at the end of the first line:

first line (with two spaces at the end)  
second line got wrapped corrently

first line (with two spaces at the end)
second line got wrapped corrently


Q.E.D.