A theme that supports free switching between multiple themes for [Hexo].
Execute the following command and modify theme in _config.yml to diversity.
git clone --depth 1 https://github.com/huazie/hexo-theme-diversity themes/diversity
_config.yml
- theme: other-theme
+ theme: diversity
There are two ways to integrate other themes as follows[Check the configuration of the themes property in _config.diversity.yml]:
themes directory at the root of the project, and name them respectively, as shown below [where diversity is the one downloaded as mentioned above]:├─themes │ ├─diversity │ ├─light │ ├─phase
landscape theme, it's as follows:"dependencies": {
"hexo-theme-landscape": "^1.0.0"
}
Execute the following command to update Diversity.
cd themes/diversity git pull
The _config.yml file located in the themes/diversity directory contains the following configuration:
title: Diversity
description: Blog Diversity, A theme that supports free switching between multiple themes for [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://github.com/hexojs/hexo-theme-landscape
phase: https://github.com/hexojs/hexo-theme-phase
light: https://github.com/hexojs/hexo-theme-light
page:
header_nav_position:
blog_scroll_height: 200
back2top:
enable: true
enable_scroll_percent: false
scroll_percent: 5
position: right
color: "#fc6423"
exclude: [next]
font:
western:
family:
chinese:
family:
nav:
family:
size:
page:
family:
comments:
style: tabs
active:
storage: true
lazyload: false
nav:
#utterances:
# text: Utterances
# order: 0
#gitalk:
# order: 1
utterances:
enable: false
loading: true
repo: user-name/repo-name
issue_term: pathname
theme: github-light
dark: github-dark
gitalk:
enable: false
github_id:
repo:
client_id:
client_secret:
admin_user:
distraction_free_mode: true
proxy: https://cors-anywhere.azm.workers.dev/https://github.com/login/oauth/access_token
issue_term: pathname
language:
giscus:
enable: false
loading: true
repo: your-username/your-repo-name
repo_id:
category:
category_id:
mapping: pathname
term:
strict: 0
reactions_enabled: 1
emit_metadata: 0
theme: light
dark: dark
lang:
input_position: bottom
data_loading: lazy
landscape theme as an example:
/images/default.png.left | center | rightpx)
true | falsetrue | false2 | 3 | 4 | 5left | rightArial | Helvetica | Tahoma | Sitka | Times New Roman | Courier New | Verdana | Georgia | Palatino | Garamond | Comic Sans MS | Trebuchet MS
楷体 | 等线 | 黑体 | 宋体 | 仿宋
1.1em or 17px)utterances | gitalktrue | falsetrue | falseutterances - Comment system name (Refer to existing comment system definitions).
true | falsetrue | falsepathname | url | title | og:title | issue number | specific term
pathname - Issue title contains page pathname. Utterances will search for an issue whose title contains the blog post's pathname URL component. If a matching issue is not found, Utterances will automatically create one the first time someone comments on your post.url - Issue title contains page URL. Utterances will search for an issue whose title contains the blog post's URL. If a matching issue is not found, Utterances will automatically create one the first time someone comments on your post.title - Issue title contains page title. Utterances will search for an issue whose title contains the blog post's title. If a matching issue is not found, Utterances will automatically create one the first time someone comments on your post.og:title - Issue title contains page og:title,Utterances will search for an issue whose title contains the page's Open Graph title meta. If a matching issue is not found, Utterances will automatically create one the first time someone comments on your post.issue number - Specific issue number. You configure Utterances to load a specific issue by number. Issues are not automatically created.other value - Issue title contains specific term. You configure Utterances to search for an issue whose title contains a specific term of your choosing. If a matching issue is not found, Utterances will automatically create one the first time someone comments on your post. The issue's title will be the term you chose.github-light | github-dark | preferred-color-scheme | github-dark-orange | icy-dark | dark-blue | photon-dark | boxy-lighttrue | falsetrue | falsepathname | url | title | issue number
pathname - Issue's Labels includes the page pathnameurl - Issue's Labels includes the page urltitle - Issue's Labels includes the page titleissue number - Specific issue number. You configure Gitalk to load a specific issue by number.zh-CN | zh-TW | en | es-ES | fr | rutrue | falsetrue | false<script> content by entering their repository details on giscus.appAnnouncements | General | Ideas | Polls | Q&A | Show and tell<script> content by selecting a Discussion category on giscus.apppathname | url | title | og:title | specific
pathname - Discussion title contains page pathname. Giscus will search for a discussion whose title contains the page's pathname URL component.url - Discussion title contains page URL. Giscus will search for a discussion whose title contains the page's URL.title - Discussion title contains page <title>. Giscus will search for a discussion whose title contains the page's <title> HTML tag.og:title - Discussion title contains page og:title. Giscus will search for a discussion whose title contains the page's <meta property="og:title"> HTML tag.specific - Specifically designated to be used in conjunction with the term configuration property.mapping is set to specific, the term property is required and must be configured as follows:
light | light_high_contrast | light_protanopia | light_tritanopia | dark | dark_high_contrast | dark_protanopia | dark_tritanopia | dark_dimmed | preferred_color_scheme | transparent_dark | noborder_light | noborder_dark | noborder_gray | cobalt | purple_darkwindow.navigator.language. Available values: zh-CN | zh-TW | en | es-ES | fr | rubottom - The comment input box will be placed below the commentstop - The comment input box will be placed above the comments, so that users can leave a comment without scrolling to the bottom of the discussion.<iframe> element.Copy the _config.diversity.yml located in the themes/diversity to the root directory of your Hexo project.
themes: [landscape,light,phase]
#ports: [5000,5001,5002]
hexo server.Copy or move the directories and files from the other directory within the themes/diversity directory to your Hexo project root directory.
The en.yml file in the languages directory under the themes/diversity folder contains the following configuration:
menu:
blog: Blog
theme: Theme
comment: Comment
button:
theme-default: DEFAULT
cancel-defalut: CANCEL
theme-redirect: REDIRECT
theme-source: SOURCE
back-to-top: BACK TO TOP
gritter:
title-theme: Theme [{0}]
text-configured: Configured
text-canceled: Cancelled
text-click-to-jump: Click here
no-theme:
tip-text: Default theme not set up! Click the button below to configure now.
btn-text: Theme Select
page:
contents: Contents
back_to_top: Back to Top
last_updated: "Last updated: %s"
loading-tips:
comment: Loading comments...
introduction:
landscape: A brand new default theme for Hexo.
phase: Feel the flow of time with Phase, the most beautiful theme for Hexo.
light: A simple theme for Hexo.
Add a config directory in the root directory of your Hexo project.
For each theme in the aforementioned multi-theme list, create a configuration directory with the corresponding theme name.
And within that configuration directory, add a corresponding _config.yml file (you can simply copy one from the original _config.yml located in your project's root directory). The structure would be something like this:
├─config │ ├─landscape │ │ ├─_config.yml │ ├─light │ │ ├─_config.yml │ ├─phase │ │ ├─_config.yml
To modify the _config.yml file in each theme's config directory, taking landscape as an example:
_config.yml
- url: http://example.com
+ url: http://example.com/landscape
- public_dir: public
+ public_dir: public/landscape
- theme: other-theme
+ theme: landscape
Within the root directory of your Hexo project, we can still add separate _config.[theme].yml files for different themes. For more information, please refer to the official documentation on Configuration.
For different themes, the generation of category and tag index pages can be enabled in their respective configurations, as shown below:
category_generator:
enable_index_page: true
layout: category-index
per_page: 10
order_by: -date
/categories/index.html]category-indextag_generator:
enable_index_page: true
layout: tag-index
per_page: 100
order_by: -date
/tags/index.html]tag-indexFor a detailed understanding, please refer to the articles in the [Blog Framework - Hexo] category on Huazie's blog.