Diversity 主题接入介绍

build and deploy NPM version Hexo version license GitHub Repo stars

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

安装

1. 接入Diversity主题

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

1
git clone --depth 1 https://github.com/huazie/hexo-theme-diversity themes/diversity
1
2
3
_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 目录内容。【推荐】
1
2
3
4
5
# 本地预览时同步【非强制覆盖】
hexo s
# 使用强制覆盖模式
hexo s --force // 本地预览时强制覆盖已存在文件
hexo s -f // 本地预览时强制覆盖已存在文件(参数简写)
  1. 执行 hexo dsync 命令专门同步 _config.diversity.yml 配置和 other 目录内容。【推荐】
1
2
3
4
5
# 本地直接同步【非强制覆盖】
hexo dsync
# 使用强制覆盖模式:
hexo dsync --force // 本地同步时强制覆盖已存在文件
hexo dsync -f // 本地同步时强制覆盖已存在文件(参数简写)

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

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

2. 接入其他主题

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

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

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

配置

详细了解,请翻看项目 README 文件。

文档

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

版本

详细了解,请查看项目 Releases

问题

反馈 Bug 或者咨询使用问题,可以

评论正在加载中...
评论正在加载中...