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
2
npm uninstall hexo-generator-index --save
npm install hexo-generator-index-pin-top --save
  • Add top: true or top: 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), add card_clustrmaps: true

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    aside:
    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: true
  • in dir theme/butterfly/layout/includes/widget:

    • create new file card_clustrmaps.pug: for the two url_for(urls), use the urls from your widget snippet

      1
      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: add if theme.aside.card_clustrmaps...

      1
      2
      3
      4
      5
      6
      7
      8
      if 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})