Hexo Adjustment

Some adjustment I’ve made.

Migrate files from Jekyll

Move all files in the Jekyll _posts folder to the source/_posts folder.
Modify the new_post_name setting in _config.yml:

1
new_post_name: :year-:month-:day-:title.md

Image align center

themes\next\source\css_schemes\Mist_posts-expanded.styl

1
.post-body img { margin: auto; }

More info: ref

Two images side by side

themes\next\source\css_common\components\tags\group-pictures.styl

1
2
3
4
5
6
.page-post-detail .post-body .group-picture-column {
// float: none;
margin-top: 10px;
// width: auto !important;
img { margin: 0 auto; }
}

In markdown post,

1
2
3
4
{% gp 2-2 %}
{% asset_img 27.png %}
{% asset_img EC.gif %}
{% endgp %}

More info: ref1, ref2

Disqus

https://disqus.com/admin/
Settings --> General --> Shoretname --> Your website shortname is xxxxx-xxxxxxxxxx
themes/next/_config.yml

1
2
3
4
5
disqus:
enable: true
shortname: xxxxx-xxxxxxxxxx
count: true
lazyload: false

Categories and Tags

1. Categories page

1
$ hexo new page categories

source/categories/index.md

1
2
3
4
5
6
---
title: Categories
date: 2019-02-15 03:52:34
type: "categories"
comments: false
---

2. Tags page

1
$ hexo new page tags

source/tags/index.md

1
2
3
4
5
6
---
title: Tags
date: 2019-02-15 03:53:35
type: "tags"
comments: false
---

More info: ref1ref2

3. Menu Settings

themes/next/_config.yml

1
2
3
4
5
6
menu:
home: / || home
#about: /about/ || user
archives: /archives/ || archive
categories: /categories/ || th
tags: /tags/ || tags

4. Font Matter

Add categories and tags to each post. Such as

1
2
3
4
5
---
title: "ECDSA and Bitcoin I: Intuition About Elliptic Curve"
categories: [ECDSA and Bitcoin]
tags: [Elliptic Curve, Math, Python Code]
---

More info: hexo doc

themes/next/layout/_partials/header/brand.swig

1
2
3
4
5
6
7
<div class="custom-logo-site-title">
<a href="{{ config.root }}" class="brand" rel="start">
<!-- <span class="logo-line-before"><i></i></span> -->
<span class="site-title">{{ title }}</span>
<!-- <span class="logo-line-after"><i></i></span> -->
</a>
</div>

6. Generate and deploy

1
$ hexo clean && hexo deploy -g

Don’t forget “-g”, we need to generate categories pages and tags pages before deployment.

7. Write a draft and publish

  • Create a markdown file
1
$ hexo new draft "Draft 01"
  • Write something and check it on local server
1
$ hexo server --draft --open
  • Publish
1
$ hexo publish Draft-01

More info: ref

8. hexo-browsersync

  • Install
1
$ npm install hexo-browsersync --save

Once installed, you are no longer need to refresh your browser again. 😃

1
$ hexo server --draft --open

Make some changes in your markdown file and save. The browser is synchronized automaticlly. 🎉

More info: GitHub repo