Featured image of post 让hugo博客和hexo tangyuxian主题支持emoji

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

hexo tangyuxian主题设置:

hexo-filter-github-emojis

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

  1. 安装

    Bash

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

    YAML

    1
    2
    3
    4
    5
    6
    
    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

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

    Ini, TOML

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

    YAML

    1
    
    enableEmoji: true
    

热爱生活 学无止境
使用 Hugo 构建
主题 StackJimmy 设计