Hexo With Theme-NexT Setup Guide
Hexo is flexible blog system and Next comes with bundle of extensions to make it easier to build up your personal blog.
| Component | Version |
|---|---|
| hexo | 7 |
| hexo-theme-next | 8 |
| NODE_VERSION | 24 |
Getting Started with Hexo
Initialize your Hexo blog system
1 | $ npm install hexo-cli -g |
Mermaid Surpport for Diagram
Hexo Next already supported the mermaid nested, here is the guideline:
https://theme-next.js.org/docs/tag-plugins/mermaid
and we needn’t install additional plugin for it.
npm install hexo-filter-mermaid-diagrams save
RSS Feed
Installation
1 | npm install hexo-generator-feed --save |
Configuration
Config feed file in {ROOT}/_config.yml, refer to the link below:
https://github.com/hexojs/hexo-generator-feed
Config the RSS link icon in the social section:
In {ROOT}/_config.next.yml
or
In {ROOT}/themes/theme_next/_config.yml
1 | social: |
Custom Theme
Here we use the theme-next as the example.
Installation
1 | cd hexo-site |
Configuration
Change the content in the _config.yml
1 | theme: next |
1 | $ hexo clean # rememeber to clean public/ |
Refer to the official site of theme-next:
https://theme-next.org
https://github.com/next-theme/hexo-theme-next
Global Avatar
Add the url into the Avatar section in the _config
1 | # Sidebar Avatar |
Create your gravatar account here:
https://en.gravatar.com/emails/
Cloudflare Analytics
Enable with JS Snippet installation in the dashboard of cloudflare analytics,
then you would get a the JS Snippet needs to be installed manually.
1 | <!-- Cloudflare Web Analytics --><script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "301040bd778923748972389sdfsdf105d8"}'></script><!-- End Cloudflare Web Analytics --> |
the token value is unique for your site and that is what we need to config in the theme-next.
Config the cloudflare analytics in the _config.next.yml of theme-next
1 | # Cloudflare Web Analytics |
Google Fonts
Prevew the google fonts here:
https://fonts.google.com/
Enable Google Fonts in the _config.next.yml of theme-next
1 | font: |
Categories & Tags
Categories apply to the posts in order, resulting in a hierarchy of classifications and sub-classifications.
Tags are all defined on the same hierarchical level so the order in which they appear is not important.
Example
1 | # Baseball is a sub-category of Sports. |
The classification records in the front-matter of the the source of markdown file
https://raw.githubusercontent.com/qzi/qzi.github.io/hexo/source/_posts/technology/hexo-go.md
Front-matter is a block of YAML or JSON at the beginning of the file that is used to configure settings for your writings. Front-matter is terminated by three dashes when written in YAML or three semicolons when written in JSON.
https://hexo.io/docs/front-matter.html
Display in the menu
Config in the [hexo_project]/_config.next.yml
1 | menu: |
Markdown Editor
Typora is a what you see is what you get editor for markdown file.
Here is my another tutorial for Typora
https://leonvision.online/technology/wysiwyg-markdown-editor-typora/
and visual studio code with markdown plugin is also another alternative choice.
Search
Enable the feature of local serach in the _config.next.yml of theme-next
1 | # Local Search |
Post Excerpt
Manually add excerpt in the front-matter of the markdown file
1 |
|
Configuration
Config in the [hexo_project]/_config.next.yml
1 | # Automatically excerpt description in homepage as preamble text. |
Refer to https://hexo.io/docs/tag-plugins#Post-Excerpt
Enhance Asset Reference
Installation
1 | $ npm i --save hexo-asset-link |
Configuration
Config in the [hexo_project]/_config.yml
1 | ... |
Markdown Syntax
1 |  |
Reference
homepage of hexo-asset-link
https://github.com/liolok/hexo-asset-link
Custom Domain Email Forwarding
Cloudflare offers free email forwarding for custom domains.
There is a another article for it: Custom domain email forwarding
Sitemap & SEO
Installation
1 | npm install hexo-generator-sitemap --save |
Configuration
Config in the [hexo_project]/_config.yml
1 | # hexo-generator-sitemap |
and then submit the url of sitemap to google search console to improve your performance on Google Search.
https://search.google.com/search-console/
Google Adsense
Register the account of google adsense and generate a unique in-article ads code snippet for your site. f
Uncomment the custom_file_path in ./_config.next.yml
1 | custom_file_path: |
Create a new file source/_data/post-body-end.njk
Paste the code snippet of in-article ads from google adsense into post-body-end.njk
More detail in google-analytics-and-adsense-in-hexo
Google Analytics
Register the account of google analysis and get the TAG ID for your site.
Config in {hexo_root}/_config.next.yml
1 | # Google Analytics |
Comment System Integration
Disqus
Disqus can allow the anonymous comment, but it is blocked in China mainland.
Here is a guide to setup Disqus in Hexo with Theme-NexT:
Add Comments Section to Your Hexo Blog
Configuration in the {hexo_root}/_config.next.yml
1 | # For more information: https://disqus.com |
Auto update the date and time
I developed a new vscode extension - Hexo Auto Updated to update last modified date and time automatically when we saved the markdown file.
Link to Hexo Auto Updated
Embed Video
Open the video in youtube, click the share button to get the embed code snippet.
Paste the code snippet into the markdown file directly.
1 | <iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/E46_veB0DPU" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> |
Force to Refresh the Browser
Presss Shift + Command + r to force to refresh the browser(Chrome) to test the result in Mac
Presss Option + Command + r to force to refresh the browser(Safari) to test the result in Mac
1 | # clean the desktop before we work |
Reference:
Hexo configuration
https://hexo.io/docs/configuration
Hexo backup
https://blog.itswincer.com/posts/7efd2818/
Add google adsense
https://juejin.im/post/5c95d230e51d45124e35cef6
Third party for theme next
https://theme-next.iissnan.com/third-party-services.html
Wirit the post
https://hexo.io/zh-cn/docs/writing.html
Front-matter
https://hexo.io/docs/front-matter.html
Asset folder
https://hexo.io/docs/asset-folders
Hexo-theme-next
https://github.com/next-theme/hexo-theme-next