In the previous article, we made it easy to write and deploy our blog, but there are still many details that can be optimized. Next, we will gradually improve our blog content.
Set Avatar#
Hexo can store images and files in many places, but placing each article in a folder or having each article correspond to an image folder will make our project increasingly bloated. Therefore, I will store the subsequent images in my own OSS (Object Storage), not an image hosting service, as many self-hosted image services currently do not support audio, video, and other formats.
After the deployment in the previous article, we will find that we already have a default avatar, and the avatar setting location is in the _config.maupassant.yml
file in the root directory:
info:
avatar: /img/avatar.png # Change to this path
discription: The meaning of life is to struggle # Personal signature below the avatar
At the same time, we can find the default avatar avatar.png
under themes/maupassant/source/img/
, we just need to replace this image.
We need to run hexo g
again to see the avatar displayed correctly.
However, for other image resources, our best practice is still to create an image folder images
under the source
directory and place our image avatar.png
in it, with the directory structure as follows:
Note: The public
folder is generated by the hexo generate
command, public/images
corresponds to the packaged files from source/images
, and public/img/avatar.png
is the storage location for the default avatar.
Modify External Links#
Also in the _config.maupassant.yml
file in the root directory:
info:
avatar: /img/avatar.png
discription: There is only one important thing
outlinkitem:
- name: envelope
outlink: [email protected]
message: Email
- name: github
outlink: https://github.com/cirry
message: Github
- name: rss
outlink: /atom.xml
message: RSS
Modify Friend Links#
links: # Friend Links
- title: Cai Xiao Niu
url: https://cirry.cn/
src: https://cirry.cn/favicon.ico
desc: Cai Xiao Niu's Blog
Set Timeline#
First, create a timeline page, using the same method as creating the Message
and About Me
pages.
hexo new page timeline
Then, in the menu
attribute of _config.maupassant.yml
, add the timeline page.
menu:
- page: home
directory: .
icon: fa-home
- page: archive
directory: archives/
icon: fa-archive
- page: about
directory: about/
icon: fa-user
- page: history # Add history page
directory: timeline/ # Configure the path of the page created above
icon: fa-book # Configure icon
- page: guestbook
directory: guestbook/
icon: fa-comments
Next, add a new piece of information in the header of source/timeline/index.md
:
---
title: Timeline
date: 2022-08-28 13:02:01
layout: timeline # Add this metadata
---
Finally, the content of the timeline can be added in _config.maupassant.yml
:
timeline:
- num: 1
word: 2022-08-20 Built this blog
- num: 2
word: 2022-08-21 Deployed the first blog
You need to run hexo server
again to see the effect.
Enable Baidu Statistics#
The first step is to obtain the Baidu Statistics ID by opening the Baidu Statistics official website and logging in.
In the account settings --> Add website, fill in the required website information correctly. Note that if the website has HTTPS enabled, please fill in the complete address; otherwise, statistics may fail.
In the code management section, copy the ID generated by Baidu Statistics, which is the content in the red box:
In _config.maupassant.yml
, find baidu_analytics
and paste the ID after it.
baidu_analytics: "b**********************4" ## Your Baidu Analytics tracking id, e.g. 8006843039519956000
Display Copyright Information at the End of the Article#
In _config.maupassant.yml
, find post_copyright
and enable the feature and configuration.
post_copyright:
enable: true
author: Cai Xiao Niu ## Your author name, e.g. tufu9441
copyright_text:
This work is licensed under the <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">"Attribution-NonCommercial-ShareAlike 4.0 International" </a> license.
## Your copyright text, e.g. The author owns the copyright, please indicate the source reproduced.
After configuration, the style will be as follows:
Enable Busuanzi Function#
Busuanzi official website, Busuanzi detailed configuration documentation
In _config.maupassant.yml
, find busuanzi
and enable the feature, set as follows:
busuanzi: true ## If you want to use Busuanzi page views please set the value to true.
The next article will discuss the installation and configuration of plugins.