hexo log automatic classification plugin


title: automatic classification plug log
Tags: Auto-category-HEXO
Cover: 'https://gitee.com/chuyuxuan/tuc/raw/master/hexo_auto_category/4.png'
the Categories:

  • skill
  • hexo configure the relevant
    date: 2020-02-08 21:00:00

Brief introduction


Hexo write the log, we usually need to maintain a front-matter information, including title, date. Blog more, in order to facilitate post categories, generally also need to set categories.
Such as the following examples:

Heat 1

This will lead to a particularly large and complex article, poor finishing:
Heat 2
Over time, you will find a lot of problems:

  • Tedious work: a lot of repetitive work category
  • Error-prone: capitalization and English catalog possible confounding. For example, there is a web directory, and occasionally we write the Web, resulting in the directory tree redundant nodes.
  • Maintainability: If you want to change the directory node in the tree, it is necessary to manually change the categories of variables for each log.

So, let us introduce here a paper 自动生成categoryplug HEXO-Auto-category , automatic classification

Automatic generated categories


The most commonly used document management strategy is to use the file system directory structure (tree directory-tree).
Similarly, in order to facilitate the management of a large number of log files, using the directory structure is a simple and feasible solutions. hexo-auto-category (Markdown) file directory where the automatic classification according to the log file, which is automatically generated markdownin front-matterthe variable categories.

Examples

For the blog source/_post/web/framework/hexo.md, the plugin will automatically generate the following categories:

categories:
  - web
  - framework

installation


The use of npmthe installation:

$ npm install hexo-auto-category --save

Heat 3

Configuration


In the site root _config.yml added:

# Generate categories from directory-tree
# Dependencies: https://github.com/xu-song/hexo-auto-category
# depth: the depth of directory-tree you want to generate, should > 0
auto_category:
 enable: true
 depth:

If you want to generate a first-level directory classification, you can set the depth attributes, such as:

auto_category:
 enable: true
 depth: 1

Compile & deployment


$ hexo clean ; hexo generate ; hexo deploy

We're done! Enjoy it!

Published 19 original articles · won praise 9 · views 7436

Guess you like

Origin blog.csdn.net/Cryu_xuan/article/details/104232173