hexo必备插件

​ hexo,这些插件少不了

  1. hexo-deployer-git 一键部署并提交到Github等仓库

    安装npm install hexo-deployer-git 官网

    配置**_config.yml**

    1
    2
    3
    4
    5
    deploy:
    type: 'git'
    repo:
    github: #仓库地址 推荐使用ssh地址,并将本地Git令牌配置到远程仓库
    branch: master #分支

    执行命令hexo clean && hexo g && hexo d 即可一键生成html内容并推送到远程仓库

  2. hexo-abbrlink 生成文章短链,防止URL因为中文路径打不开,SEO优化等效果

    安装 npm install hexo-abbrlink

    配置**_config.yml**

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    abbrlink:
    alg: crc32 #support crc16(default) and crc32 进制
    rep: hex #support dec(default) and hex 算法
    drafts: false #(true)Process draft,(false)Do not process draft. false(default)
    ## Generate categories from directory-tree
    ## depth: the max_depth of directory-tree you want to generate, should > 0
    auto_category:
    enable: true #true(default)
    depth: #3(default)
    over_write: false
    auto_title: false #enable auto title, it can auto fill the title by path
    auto_date: false #enable auto date, it can auto fill the date by time today
    force: false #enable force mode,in this mode, the plugin will ignore the cache, and calc the abbrlink for every post even it already had abbrlink.

    执行命令hexo clean && hexo g 可以在文件头信息看到abbrlink字段

  3. hexo-blog-encrypt 文章加密,打造私密花园

    安装npm install hexo-blog-encrypt

    配置**_config.yml**

    1
    2
    3
    4
    5
    6
    7
    8
    9
    # Security
    encrypt: # hexo-blog-encrypt
    abstract: 有东西被加密了, 请输入密码查看.
    message: 您好, 这里需要密码,按Enter结束.
    tags: #根据标签加密
    - {name: 标签1, password: 6851}
    - {name: 标签2, password: 3163}
    wrong_pass_message: 抱歉, 这个密码看着不太对, 请再试试.
    wrong_hash_message: 抱歉, 这个文章不能被校验, 不过您还是能看看解密后的内容.

    执行命令hexo clean && hexo g 文章已经被加密,还可以给文章配置单独加密,请看官网。

  4. hexo-generator-baidu-sitemap 生成百度站点地图,SEO优化

    安装

    1
    2
    cnpm install hexo-generator-sitemap --save
    cnpm install hexo-generator-baidu-sitemap --save

    配置**_config.yml**

    1
    2
    3
    4
    5
    6
    7
    8
    Plugins:
    - hexo-generator-baidu-sitemap
    - hexo-generator-sitemap

    baidusitemap:
    path: baidusitemap.xml
    sitemap:
    path: sitemap.xml

    在source目录添加robots.txt文件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    User-agent: *
    Allow: /
    Allow: /archives/
    Allow: /categories/
    Allow: /tags/
    Allow: /about/
    Disallow: /vendors/
    Disallow: /js/
    Disallow: /css/
    Disallow: /fonts/
    Disallow: /fancybox/
    Sitemap: https://域名/sitemap.xml
    Sitemap: https://域名/baidusitemap.xml

    执行命令hexo clean && hexo g 在public文件夹下可以看到两个xml文件。

  5. hexo-theme-butterfly 主题插件

    安装 npm insatll hexo-theme-butterfly