让hugo博客和hexo tangyuxian主题支持emoji
hexo tangyuxian主题设置:
hexo-filter-github-emojis
用“过滤器”方案。过滤器(Filter) 比渲染器更强悍,它会在最后生成的 HTML 里暴力替换关键词。
-
安装:
Bash
1
npm install hexo-filter-github-emojis --save -
在根目录
_config.yml添加这一段(最省心):YAML
1
2
3
4
5
6githubEmojis:
enable: true
className: github-emoji
inject: true
styles:
- 'display: inline !important; vertical-align: middle; height: 1.1em;'
hugo博客设置:
在 Hugo 项目的根目录下,找到你的配置文件(hugo.toml、hugo.yaml 或 config.toml),添加以下配置:
-
如果你使用的是
hugo.toml(新版默认):Ini, TOML
1
enableEmoji = true -
如果你使用的是
config.toml(旧版常见):Ini, TOML
1
enableEmoji = true -
如果你使用的是
hugo.yaml:YAML
1
enableEmoji: true