1、安装 hexo-tag-config
npm install hexo-tag-config --save
2、任意 markdown 文档引用 _config.yml
变量输出
博客域名:{% config url %}
输出效果
博客域名:https://blog.com
也支持自定义的变量
在 _config.yml
插入
mail: [email protected] cdn: https://cdn.com/ html: <a href="https://cn.bing.com">必应一下</a>
任意 markdown 文档引用
邮箱:{% config mail %} <img src="{% config img %}images/hexo.png" alt="hexo"> <p>{% config html %}</p>
输出效果
邮箱:[email protected] <img src="https://cdn.com/images/hexo.png" alt="hexo"> 必应一下
参考来源:
https://github.com/hexojs/hexo/issues/2756#issuecomment-451710749
https://github.com/yoshinorin/hexo-tag-config