- If there are no special instructions below,
_config.yml
all refer to the theme profile,which is located in the3-hexo
directory
1. Initialize the _config.yml in the blog
1.1 Internationalization
language: en #Supports zh-CN and en
1.2 Turn off hexo’s built-in code highlighting
Themes have theme highlighting built in, so you need to disable hexo’s built-in highlighting.
highlight:
enable: false
2. About functional
2.1 Custom home page
See this article: 3-hexo Configuration Home Page (Article by 3-hexo original author)
2.2 Shortcut key
See this article: 3-hexo Shortcut Key Description (3-hexo original author’s article)
2.3 More author mode
See this article: 3-hexo Multi-author model (3-hexo original author’s article)
2.4 Open the About page
1.Create the About
page by doing the following in the hexo
root directory.
hexo new page "about"
2.Location: source/aoubt/index.md
, edit as needed.
3.Turn on the display in the theme: Change the on
of about
in the theme root directory _config.yml
to true
, as shown below
menu:
about: # 'About' button
on: true # Whether to display
url: /about # Jump link
type: 1 # Jump Type 1: intra-station asynchronous jump 2: current page jump 3: A new tab page is opened
2.5 Add music plugin
3 - hexo added music plug-in (3 - hexo author of the article)
2.6 Configure the comment system
3 - hexo comment set (3 - hexo author of the article)
3. Style Settings
3.1 Code highlights
First, turn off the highlighting in the hexo root directory _config.yml
:
highlight:
enable: false
Highlight Settings in _config.yml
under the configuration theme:
You can follow the prompts to configure your favorite highlighted theme
highlight:
on: true # true Turn on code highlighting
lineNum: true # true Displays the line number
theme: darcula
# code highlight the theme, the effect can check https://highlightjs.org/static/demo/
# Supported Topics:
# sublime: Refer to sublime's highlighted theme
# darcula: Refer to the darcula theme in idea
# atom-dark: Refer to Atom's dark theme
# atom-light: Refer to Atom's light theme
# github: Refer to the highlighted topics in the GitHub edition
# github-gist: GitHub-Gist topic
# brown-paper: brown paper effect
# gruvbox-light: gruvbox's light theme
# gruvbox-Dark: gruvbox's dark theme
# rainbow :
# railscasts :
# sunburst :
# kimbie-dark :
# kimbie-light :
# school-book: Paper effect
3.2 MathJax Mathematical formula
Modify _config.yml
# MathJax Math formula support
mathjax:
on: true #Whether to enable
per_page: false # If only a single page is rendered, this option is set to false and mathjax: true is added to the page
Considering the loading speed of the page, support for rendering individual pages.
Set per_page: false
and add mathjax: true
to the page you want to render
Attention:
- Because hexo’s MarkDown renderer conflicts with MathJax, it may cause abnormal use of matrices, etc. So there are two things you need to change before you can use it
- Edit the
node_modules\marked\lib\marked.js
script
1.To line 451, this step cancels the escape of ‘\,{,}‘
escape: /^\\([\\`*{}\[\]()# +\-.!_>])/,
change to
escape: /^\\([`*\[\]()# +\-.!_>])/,
2.In line 459, this step removes the escape of the italic marker _
.
em: /^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
change to
em:/^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,
3.3 Table style
3 styles are currently provided, modify _config.yml
table: green_title
# table style
# is empty similar to github's table style
# green Green style
# green_title table style with cyan header
3.4 Hover style for article lists
ove the mouse into the background color and change the text color, set _config.yml
.
#Post list mouse over style, default effect when empty
article_list:
hover:
background: '#e2e0e0' # Background::'#c1bfc1' '#fbf4a8'
color: #Text colors available: '#ffffff'
# Attention: Since the color contains #, use single quotation marks'
3.5 Turn on word count
1.To enable this function, install the plug-in and run npm i hexo-wordcount --save
in the hexo root directory
2.Edit _config.yml
word_count: true
3.6 Change the avatar
Two ways:
1.Replace source/img/avatar.jpg
image
2.Modify the profile picture configuration record in _config.yml
# Your avatar url
avatar: /img/avatar.jpg
favicon: /img/avatar.jpg
#3.7 Set the link icon
- If you need a custom icon to see the article 3 - hexo add custom icon (3 - hexo author of the article)
As follows, if there is no connection, the icon is not displayed.
# Link icon, not displayed if the link is empty
link:
rss: /atom.xml
github: https://github.com/XU-Zijin
#facebook:
#twitter:
#linkedin:
#instagram:
#reddit:
#weibo:
#jianshu:
zhihu:
#csdn:
#oschina:
#juejin:
email: 3279388083@qq.com
qq: 3279388083
kugou: https://www.kugou.com/
#neteasemusic:
gitee: https://gitee.com/xzj0512
4. Sort and top
4.1 Sort by category
By default, it is sorted according to the positive first letter order. Since Chinese cannot be sorted according to the first letter of Pinyin in the nodejs
environment, a custom sorting method is added. The following configuration is found in _config.yml
under the theme, and category.sort
is defined in the classification order.
Rule: A category defined in sort
is more advanced than a category
not defined in sort
# Article category Settings
category:
num: true # Displays the number of articles by category
sub: true # Enables multilevel classification
sort:
- Read a book.
- Large front end
- Back end
- Database
- Tools.
- Operation and maintenance
4.2 Article sorting
By default, the list of articles is in reverse order by creation time (the date
defined in the article below).
The use of top will place the top article, multiple top articles when the greater the value defined by top
, the more advanced.
title: 3-hexo Description
date: 2023-03-26 12:11:27
top: 1
categories:
- Tools.
tags:
- hexo
- 3-hexo
5. About writing articles
5.1 How to write
It is best to write a collection of essays and labels for each article to facilitate screening and viewing.
It is generally recommended to set a collection of articles with one or more tags
categorie
s: Collections, list on the left
tags
: Tags, filtered by #
For example, the Settings for this article
title: 3-hexo Description
date: 2023-03-26 12:11:27
top: 1
categories:
- Tools.
tags:
- hexo
- 3-hexo
5.2 Writing
- Set the template: blog root directory: scaffolds/post.md
Add categories
,tags
, so that future templates generated by hexo new
do not have to write these two words.
Of course, you can also include any section that you will have in every article.
title: {{ title }}
date: {{ date }}
categories:
tags:
In this way, use hexo new <title>
. This is the default content of the generated makedown(.md) file.
Please indicate the source for reprinting, welcome to research the sources quoted in the article, welcome to point out any errors or not clear expression. Leave a comment in the comment section below or email us at [email protected]