Hexo 配置

本文最后更新于:2024年3月18日 凌晨

Hexo 配置

自定义配置文件的路径

1
2
3
4
5
# 使用 custom.yml 代替默认的 _config.yml
hexo server --config custom.yml

# 使用 custom.yml 和 custom2.json,其中 custom2.json 优先级更高
hexo generate --config custom.yml,custom2.json,custom3.yml
  • 自定义配置文件的路径,指定这个参数后将不再使用默认的 _config.yml
  • 你可以使用一个 YAML 或 JSON 文件的路径,也可以使用逗号分隔(无空格)的多个 YAML 或 JSON 文件的路径,例如:
1
2
3
4
5
# 使用 custom.yml 代替默认的 _config.yml
hexo server --config custom.yml

# 使用 custom.yml, custom2.json 和 custom3.yml,其中 custom3.yml 优先级最高,其次是 custom2.json
hexo generate --config custom.yml,custom2.json,custom3.yml
  • 当你指定了多个配置文件以后,Hexo 会按顺序将这部分配置文件合并成一个 _multiconfig.yml,如果遇到重复的配置,排在后面的文件的配置会覆盖排在前面的文件的配置,这个原则适用于任意数量,任意深度的 YAML 和 JSON 文件。

本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!