hexo杂记
2020-06-09 / 范阳布衣

Hexo杂记

hexo d后 ERROR Deployer not found: git

$ hexo d
ERROR Deployer not found: git

npm install --save hexo-deployer-git

如果想要在Hexo放图片可以安装 hexo-asset-image插件:

在_config.yml文件中设置 post_asset_folder: true

$npm install https://github.com/CodeFalling/hexo-asset-image – save

当用户创建文章的时候,同时在post会创建一个一样的文件夹,在图片中放入这个文件

![NAME](文章名字/图片.jpg)

新建文章可用Hexo命令创建:

hexo new

生成(文章)时默认生成categories配置项
categories有点类似tags,写在文章属性之中,所以需要在文章生成时添加categories属性。
编辑/scaffolds/post.md,在最下面添加一行categories

title: hexo杂记
date: 1591685901000
tags:
categories:

生成分类、归档、标签

hexo new page “categories”

修改文章永久链接为随机编号
  • 安装abbrlink插件
    npm install hexo-abbrlink –save

  • 编辑站点配置文件
    打开博客根目录下的站点配置文件_config.yml,修改如下配置:

    #permalink: :year/:month/:day/:title/
    #permalink_defaults:
    permalink: posts/:abbrlink/
    abbrlink:
    alg: crc32 #support crc16(default) and crc32
    rep: dec   #support dec(default) and hex
  • 下面解释说明一下:

首先指定Hexo文章永久链接的格式,接下来两个是abbrlink插件的设置:

alg -- Algorithm (currently support crc16 and crc32, which crc16 is default)
rep -- Represent (the generated link could be presented in hex or dec value)

这两个设置的示例如下:

crc16 & hex
https://post.zz173.com/posts/66c8.html

crc16 & dec
https://post.zz173.com/posts/65535.html

crc32 & hex
https://post.zz173.com/posts/8ddf18fb.html

crc32 & dec
https://post.zz173.com/posts/1690090958.html

使用hexo clean && hexo g重新生成博客,在博客源文件可以看到自动生成的abbrlink编号:

本文链接:
http://blog.zyrcc.cn/html/3351943245/