本人hexo博客配置

本人的hexo博客配置了一些选项,安装了一些插件,接下来依次介绍:

安装fluid主题

https://fluid-dev.github.io/hexo-fluid-docs

1
npm install --save hexo-theme-fluid

配置数学公式显示

根据fluid主题的指引:https://fluid-dev.github.io/hexo-fluid-docs/guide/#latex-%E6%95%B0%E5%AD%A6%E5%85%AC%E5%BC%8F

  1. 修改主题配置文件(_config.fluid.yml)

    1
    2
    3
    4
    5
    post:
    math:
    enable: true
    specific: true
    engine: mathjax
    本人使用了mathjax引擎,并设置specific为true,省的每篇博客都要标记fromt-matter

  2. 切换渲染器为pandoc

    1
    2
    npm uninstall hexo-renderer-marked --save
    npm install hexo-renderer-pandoc --save

  3. 自定义修改设置
    修改文件:node_modules\hexo-theme-fluid\layout\_partials\plugins\math.ejs 在Windows.MathJax.tex中添加tags配置,以支持交叉引用,参考mathjax文档:https://docs.mathjax.org/en/latest/input/tex/eqnumbers.html

    1
    2
    3
    4
    5
    window.MathJax = {
    tex: {
    tags: 'ams'
    }
    };

支持自动渲染超链接

需求详情: markdown本身必须把链接写成[xxx](https://.....)的格式才会渲染,现在直接输入一个链接也会渲染。

默认的渲染器hexo-renderer-marked有个参数是autolink: true,默认开启

而我换了hexo-renderer-pandoc,默认没有这个功能,因此,修改配置文件_config.yml,添加:

1
2
pandoc:
extensions: ["+autolink_bare_uris"]

支持图片链接修正

需求详情: 博客中插入图片时,我会建立一个同名的文件夹用来存图片,这样的话markdown中插入图片的代码是:![image](post_name/example.jpg),这样typora等渲染正确,我希望hexo也可以渲染正确。

hexo官方推荐的插入图片的写法是: _config.yml中启用资源文件夹

1
post_asset_folder: true

然后用标签插件的写法插入图片

1
{% asset_img example.jpg This is an example image %}

但是这样我本地无法预览,而且不符合markdown规范,不好操作。

因此我装了一个插件,在博客中直接写:

![image](post_name/example.jpg)

既可以本地正确用typora等识别,也可以正确渲染的插件,hexo-asset-img,链接为:https://github.com/yiyungent/hexo-asset-img

基本就以上内容,这样博客就已经非常不错了,数学公式也很完善。


本人hexo博客配置
https://horizon86.github.io/2025/09/06/本人hexo博客配置/
作者
horizon86
发布于
2025年9月6日
许可协议