Skip to content

Repository files navigation

Diversity build and deploy NPM version Hexo version license GitHub Repo stars

博客多样性,一款多主题自由切换的Hexo主题

英文说明/English Documentation

安装

1. 接入Diversity主题

在你的 Hexo 项目根目录,执行以下命令,并将 _config.yml 中的 theme 修改为 diversity

git clone --depth 1 https://github.com/huazie/hexo-theme-diversity themes/diversity
_config.yml
- theme: other-theme
+ theme: diversity

同步 Diversity 主题配置和资源

你可以采用如下三种方式:

  1. 手动同步【不推荐】

themes/diversity 目录下的 _config.diversity.yml,添加到你的 Hexo 项目根目录。

themes/diversity 目录下的 other 目录中的目录和文件复制或移动到你的 Hexo 项目根目录。

  1. 执行 hexo server 命令后同步 _config.diversity.yml 配置和 other 目录内容。【推荐】
# 本地预览时同步【非强制覆盖】
hexo s
# 使用强制覆盖模式
hexo s --force     // 本地预览时强制覆盖已存在文件
hexo s -f          // 本地预览时强制覆盖已存在文件(参数简写)
  1. 执行 hexo dsync 命令专门同步 _config.diversity.yml 配置和 other 目录内容。【推荐】
# 本地直接同步【非强制覆盖】
hexo dsync
# 使用强制覆盖模式:
hexo dsync --force // 本地同步时强制覆盖已存在文件
hexo dsync -f      // 本地同步时强制覆盖已存在文件(参数简写)

当然你也可以选择通过项目依赖导入,在 Hexo 项目 package.json 文件中添加如下【x.x.x 替换为指定版本号】:

"dependencies": {
    "hexo-theme-diversity": "^x.x.x"
}

2. 接入其他主题

有如下两种方式【查看 _config.diversity.ymlthemes 属性配置】:

  • 将待接入主题相关的源码下载到项目根目录的 themes 目录下,并各自命名,如下所示【其中 diversity 是上述所下载的】:
├─themes
│  ├─diversity
│  ├─light
│  ├─phase
  • 通过项目依赖导入,比如 landscape 主题,如下:
"dependencies": {
    "hexo-theme-landscape": "^1.0.0"
}

添加其他主题相关配置,详细说明请查阅 docs/zh/other-config.md

更新

执行以下命令,用以更新 Diversity

cd themes/diversity
git pull

配置

Diversity 主题配置

详细 Diversity 主题配置说明,请查阅 docs/zh/diversity-config.md

国际化配置

详细国际化配置说明,请查阅 docs/zh/i18n-config.md

数据文件配置

详细数据文件配置说明,请查阅 docs/zh/data-config.md

多主题相关配置

详细多主题相关配置说明,请查阅 docs/zh/other-config.md

文档

详细了解,请翻看 Huazie 的博客分类之 博客框架-Hexo 中的文章。

插件

以下为 Diversity 主题独立出来的 Hexo 插件,欢迎大家使用:

About

A diverse theme allowing free theme-switching for Hexo.【一款多主题自由切换的Hexo主题】

Topics

Resources

Stars

25 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages