让hugo博客和hexo tangyuxian主题支持emoji

hexo tangyuxian主题设置:

hexo-filter-github-emojis

用“过滤器”方案。过滤器(Filter) 比渲染器更强悍,它会在最后生成的 HTML 里暴力替换关键词。

  1. 安装

    Bash

    npm install hexo-filter-github-emojis --save
  2. 在根目录 _config.yml 添加这一段(最省心):

    YAML

    githubEmojis:
      enable: true
      className: github-emoji
      inject: true
      styles:
        - 'display: inline !important; vertical-align: middle; height: 1.1em;'

hugo博客设置:

在 Hugo 项目的根目录下,找到你的配置文件(hugo.tomlhugo.yamlconfig.toml),添加以下配置:

  • 如果你使用的是 hugo.toml (新版默认):

    Ini, TOML

    enableEmoji = true
  • 如果你使用的是 config.toml (旧版常见):

    Ini, TOML

    enableEmoji = true
  • 如果你使用的是 hugo.yaml:

    YAML

    enableEmoji: true