This blog is based on the Butterfly theme.

This post is for me, as a memo to the blog.

General article settings

The part is wrapped with --- at the top of the markdown article.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
---
# Required
title: xxx
# If it is not empty, it will be displayed on the article list page.
description: empty or xxx
# Create time
date: yyyy-MM-dd HH:mm:ss
# Only one category, single level, or multi-levels.
categories:
# Single level
- single-layer-categ
# Multi level
- [Layer-1, Layer-2, Layer-3]
# Some words reflect the key points of the article.
tags:
- yyy
- zzz
---

No comment

1
2
3
4
5
6
7
8
9
10
11
---
title: xxx
description: empty or xxx
date: yyyy-MM-dd HH:mm:ss
categories:
- single-layer-categ
- [Layer-1, Layer-2, Layer-3]
tags:
- yyy
- zzz
---

Categories appointment

Update at any time.

Tags appointment

Conventions on the definition and scope of use of fixed and special tags.

  • Translate

    Articles translated by myself, whether from Chinese to English or from English to Chinese.

  • Original

    Articles summarized by myself.

  • Repost

    Repost articles written by others to my blog, which may be supplemented.

  • ……

Update at any time.

Blog directory structure

Need to rely on plug-ins to solve the problem of image relative paths. See the appendix for details.

Example

blog_directory_structure

Appointment

  • Article dir

    • Structure - /[blog root path]/source/_posts/[category dir]/[sub category dir]/[series dir]/[article dir]/[article dir inner structure]
    • [category dir] - Folder created based on categories appointment. It can be multi-level, and series articles will also be classified folders.
    • [article dir] - Directory named after the article title.
  • [Article dir inner structure]

    It usually consists of one markdown file and two folders.

    • [file] index.md - Fixed name. Post’s markdown source file.
    • [dir] index - Fixed name. Resource folder, storing pictures or files to be referenced in articles. The folder name must same as the post’s markdown source file.
    • [dir] ref - Reference folder. Storing process files, like “reference material”, “mind map”, “outline” and so on. They won’t be released unless use the .md format to store them.
  • Article title structure

    • Separate words with a -.

    • If it is a series of articles: [series name] + [space] + [-] + [space] + [seq number] + [.] + [article title name]

      The [seq number] is Optional.

Example - series article

directory structure: _post/[category dir]/[sub category dir]/[series dir]/[article dir]/*

directory case: _post/life/travel/china/1-delicious-food/*

article dir: 1-delicious-food

article title: china - 1.delicious-food

Release steps and commands

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 1. Complete the article based on 'directory structure'.
edit article on `/[blog root path]/source/_posts/***/index.md`

# 2. Open the shell tool and enter the blog root directory.
cd /[your blog root path]/

# 3. Clear generated blog publish files if it exists.
hexo clean

# 4. Generate blog publish files.
hexo g

# 5. Start the local server.
hexo s

# 6. Access the address(http://localhost:4000/) in the browser and check the effect.

# 7. If the effect is no problem, deploy.
# Blog files will be uploaded to GitHub according to the '_config.yml'.
hexo d

# 8. Finish. You can visit https://massaton.github.io/

Appendix

Tips

  • Blog theme based on https://butterfly.js.org

  • Inside the _post folder, including subfolders, each MD file will be compiled as a post for publishing.

  • When an image is on the Internal Site and used a relative path in the post, the image file should be saved to the resource folder[501], otherwise, the images cannot be copied to the publishing directory when publishing.

  • When a file is on the Internal Site and used a relative path in the post, the file should be saved to the resource folder. When referring to a file in an article, the path should not include the resource folder[502].

  • When need to refer to articles on this site, use the {% post_link %} function.

  • Use ‘hexo-reference’ plug-in process footnotes.

    1
    npm install hexo-reference --save

    Notice Footnotes can only use numbers, not words.

  • Use ‘hexo-generator-index-pin-top’ plug-in process article top.

    1
    2
    3
    cd [blog-path]
    npm uninstall hexo-generator-index --save
    npm install hexo-generator-index-pin-top --save

    Then, use ‘top’ property on Front-matter, value is ‘true’ or number, the larger the number, the higher the article.

About image path

Use a plug-in to solve the problem of using relative paths for images in the Internal Site, so that the images on the site can be displayed correctly in the editing and publishing status.

The images outside the station can be directly used by the full path.

Install the plugin and configure the Hexo

  • Open the asset folder function in Hexo’s _config.yml

    1
    post_asset_folder: true
  • Install the “hexo-renderer-marked” plugin in the blog root path

    1
    npm install hexo-renderer-marked --save

Modify the code of the plugin

In the /node_modules/hexo-renderer-marked/lib/renderer.js, modify the code as shown below.

plugin-custom-code

About links within the post

Quote Internal Site file (pdf)

Quote the Internal Site Page

Quote third-party web page

Quote current page anchor

参考


  1. 201.Is just about life.
  2. 202.Some views or phenomena are based on thinking about life.
  3. 203.Some fragments of life, like social media sharing.
  4. 204.Is just about the code world.
  5. 205.Some Thoughts on Technical Management.
  6. 206.Technology-oriented articles.
  7. 207.The in-depth analysis of some valuable interview questions collected at ordinary times and used during the interview.
  8. 208.Sharing is generated by reading, such as reading notes and book pieces.
  9. 299.Other articles such as this post do not belong to the above categories.
  10. 501.Folder with the same name and level as the article.
  11. 502.The first level directory needs to be removed manually.