Reference on Building a Hexo Blog
Introduction
Welcome to my blog, this is my first post, thanks to the tutorial on how to build a blog with Hexo and the open-source themes.
The following tutorial links are Chinese.
Create a blog using hexo
Tutorial Link: Tutorial on how to build your own blog with Hexo
Install Hexo
npm install hexo-cli -g
npm install hexo-deployer-git --save
Useful Hexo Commands
- Clean caches (e.g. when changing themes):
hexo clean
- Generate pages:
hexo generate
/hexo g
- Check Locally:
hexo server
- Deploy on GitHub Page:
hexo deploy
/hexo d
- Or just use:
hexo g -d
- Create new page:
hexo new page "new page's title"
- Create new post:
hexo new post "new post's title"
Hexo Theme Recommendation
How to let your blog got searched on Baidu & Google
Tutorial Link: Tutorial on how to add your blog in Google & Baidu
Another tutorial: Tutorial on how to add your blog in Google & Baidu
Butterfly Theme
How to Stick posts on top
- Uninstall hexo-generator-index and install hexo-generator-index-pin-top
1 | npm uninstall hexo-generator-index --save |
- Add
top: true
ortop: n
(n is a integer) to the top posts’ Front-matter, the more the number is, the more top for the post.
How to add clustrmaps tracker
Referenced from this post
Get your clustrmaps tracker widget code snippet from clustrmaps.com
In your config yaml(e.g.
_config.butterfly.yaml
), addcard_clustrmaps: true
1
2
3
4
5
6
7
8
9
10
11
12
13aside:
enable: true
mobile: true # display on mobile
position: right # left or right
card_author:
enable: true
description:
button:
icon: fab fa-github
text: Follow Me
link: https://github.com/xxxxxx
(some configs here...)
card_clustrmaps: truein dir
theme/butterfly/layout/includes/widget
:create new file
card_clustrmaps.pug
: for the twourl_for(urls)
, use the urls from your widget snippet1
2
3
4
5
6
7.card-widget.card-map
.card-content
.item-headline
i.fa.fa-map-marker(aria-hidden="true")
span= _p('Clustrmaps Visitors Tracker')
a(href=url_for('https://clustrmaps.com/site/1bjer'))
img(src=url_for('//clustrmaps.com/map_v2.png?cl=ffffff&w=400&t=m&d=pwHQFCQkJfEdS9yBxwK0hWdLK80o-WQKYFAQ_yMGtrs'))edit
index.pug
: addif theme.aside.card_clustrmaps...
1
2
3
4
5
6
7
8if theme.aside.enable
if page.aside !== false
#aside_content.aside_content
if theme.aside.card_author.enable
!=partial('includes/widget/card_author', {}, {cache:theme.fragment_cache})
(some code here...)
if theme.aside.card_clustrmaps
!=partial('includes/widget/card_clustrmaps', {}, {cache:theme.fragment_cache})
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment
TwikooLivere