Hexo Next Theme Customization
Preface
Please refer to next theme documentation page for more settings. Settings discussed in this blog post are the one used for this site only.
Change favicon
After changing to next theme, the Hexo site uses the default next favicon, you could change to your preferred favicon for your blog.
For me, I choose the reading icon from here and use Favicon Generator to generate icons and stored them under source/images folder as shown below.
1 | . |
Remember to change _config.next.yml as well:
1 | favicon: |
Display Categories and Tags Page
I prefer to use categories and tags pages for a better organization.
To make some buttons like Categories and Tags appear in the Menu Settings section, I first change next theme configuration file.
1 | # --------------------------------------------------------------- |
Besides changing next theme configuration file, source/categories/index.md and source/tags/index.md also need to be created with following contents.
1 |
|
1 |
|
Read More Button
By default, I realised the whole post is displayed on the home page, which means lots of scrolling is required to view the next post. By adding this line <!-- more --> in a markdown file, a Read more >> button will be generated to minimize the post height in the home page.
After adding <!-- more --> in the markdown files, run following commands:
1 | # generate static files locally |
Faster Animation
The default next theme’s animation is quite slow, however, I found out changing enable: false under motion section, the sidebar (red box in the screenshot below) with author name and number of posts disappeared completely.
After some research online, I decided to go for this configuration.
async: trueallows all elements to load togetherpost_block: noneallows no css animation to be applied when loading an element
1 | # --------------------------------------------------------------- |
However, the menu area above sidebar (blue box in the screenshot above) still has some css animation effects applied, I am not sure how to change it though, but in general I am quite happy with the loading time now!
Social Icons
Add a GitHub social icons in the blog.
1 | # Social Links |
To display social icons only without descriptions.
1 | social_icons: |
RSS Feed
Install hexo-generator-feed:
1 | npm install hexo-generator-feed --save |
Add RSS Feed icon at social icons section:
1 | social: |
Local Search
Install hexo-generator-searchdb:
1 | npm install hexo-generator-searchdb |
Change settings at:
1 | # Local Search |
If some strange icons appeared in the menu area after hexo generate command, remember to do a hexo clean before hexo generate.
Codeblock Copy Button
Enable copy button on codeblock
1 | # Add copy button on codeblock |