【Hexo】常用插件

本文最后更新于:2 个月前

1、hexo-deployer-git

hexo-deployer-git
Hexo 支持一键部署网站到 git 仓库上,其他的一键部署方式参考 官网介绍

  • 安装
    1
    npm install hexo-deployer-git --save
  • 配置
    1
    2
    3
    4
    5
    6
    7
    8
    9
    # Deployment
    ## Docs: https://hexo.io/docs/one-command-deployment
    deploy:
    - type: git
    repository: git@github.com:calmzo/calmzo.github.io.git # <仓库链接> # 可以是 https 链接也可以是 git 链接
    branch: gh-pages # [分支] # GitHub 的网站分支为 gh-pages,其他网站可能有所不同
    - type: git
    repository: git@gitee.com:Calm-Chan/Calm-Chan.git # <仓库链接> # 可以是 https 链接也可以是 git 链接
    branch: gh-pages # [分支] # GitHub 的网站分支为 gh-pages,其他网站可能有所不同

2、生成非中文的链接

hexo-abbrlink

  • 安装
1
npm install hexo-abbrlink --save
  • 配置
    首先修改 _config.yml 文件中的 permalink 的配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# abbrlink config
## https://github.com/rozbo/hexo-abbrlink
abbrlink:
alg: crc32 # support crc16(default) and crc32
rep: hex # support dec(default) and hex
drafts: true # (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 # 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.

3、收录

hexo-generator-sitemap
为了使博客能被谷歌、bing、百度收录,最好生成 sitemap 方便爬取,整体流程可以先参考这篇博文

  • 安装

    1
    npm install hexo-generator-sitemap --save
  • 配置

    1
    2
    3
    4
    5
    6
    7
    8
    # hexo-generator-sitemap
    ## https://github.com/hexojs/hexo-generator-sitemap
    sitemap:
    path: sitemap.xml
    # template: ./sitemap_template.xml
    rel: true
    tags: false
    categories: false

4、hexo-filter-github-emojis

hexo-filter-github-emojis

  • 安装

    1
    npm install hexo-filter-emoji
  • 配置
    在站点配置文件 .config.yml 中增加:

    1
    2
    3
    4
    5
    6
    emoji:
    enable: true
    className: github-emoji
    inject: true
    styles:
    customEmojis:
  • 使用方法
    输入对应的 emoji 编码就行了,这个是两种方法都通用的
    例如:输入笑脸对应的 emoji 编码 : smile : 就可以得到 😄

  • 方法二额外的用法:
    如果你不喜欢 :: 这种方法,你还可以这样采用 tags 的方式:

    1
    {% emoji sparkles %}

    为了避免有时候 :: 带来的解析问题,我们可以在 front-matter 中添加 no-emoji: true 来禁用 :: 的方式:

1
2
3
4
5
6
7
---
title: Hello World
no-emoji: true
---
🎉 as it is.
{% emoji tada %} still works.

编码合集

5、添加 RSS 订阅支持

hexo-generator-feed

  • 安装
    1
    npm install hexo-generator-feed --save
  • 配置
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    # 添加 RSS 订阅支持(可选的)
    feed:
    type: atom
    path: atom.xml
    limit: 20
    hub:
    content:
    content_limit: 140
    content_limit_delim: ' '
    order_by: -date

【Hexo】常用插件
https://calmchen.com/posts/468ec796.html
作者
Calm
发布于
2022年5月7日
更新于
2022年7月14日
许可协议