玩命加载中 . . .

hexo


记录搭建博客出现的问题

1. 部分文章的图片不显示

  • 路径问题,存图片的文件夹不能有空格

2. 图片名称重复显示

​ 大概就是这样,然后F12查看代码

图片名显示两次(一次在 alt,一次在 figcaption)。

这里采用的方法是把在 figcaption的隐藏掉

步骤

  1. 打开 themes/matery/layout/_partial/post-detail.ejs

  2. 1
    文章最开头直接复制

    里面添加:

    1
    2
    3
    4
    5
    <style>
    figure figcaption {
    display: none !important;
    }
    </style>

3. 行外公式正确显示,行内公式不行

  • 打开 Matery 主题的 _config.yml

  • 找到 math 相关配置

    • ```yaml mathjax: enable: true cdn: https://cdn.bootcss.com/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12

      - 把这部分修改为:

      - ```yaml
      mathjax:
      enable: true
      cdn: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
      options:
      tex:
      inlineMath: [["$", "$"], ["\\(", "\\)"]]
      displayMath: [["$$", "$$"], ["\\[", "\\]"]]

​ 重新生成,正确显示

4. 超链接不显示(存疑)

问题:

超链接显示问题

解决:

  1. 打开 themes/matery/layout/_partial/post-detail.ejs

  2. </body> 之前,替换为以下 JavaScript 代码

1
2
3
4
5
6
7
8
9
10
11
<script>
document.addEventListener("DOMContentLoaded", function() {
let content = document.getElementById("articleContent");
if (content) {
content.innerHTML = content.innerHTML.replace(
/\b(https?:\/\/[^\s<]+)(?=\s|$)/g,
'<a href="$1" target="_blank" rel="noopener noreferrer">$1</a>'
);
}
});
</script>
  1. 保存后,重新生成博客
1
2
3
hexo clean
hexo g
hexo s

解决:

​ 别直接cv链接,用

1
[文章名](链接)

文章作者: LS
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 LS !
  目录