返回
Featured image of post 【hugo】| Hugo stack 主题美化

【hugo】| Hugo stack 主题美化

字体修改

原来的字体看着有点别扭,所以把全站的字体改为了思源宋体,参考了Hugo|月球基地开发历程中的修改全站字体

在layouts/partials/head/custom.html(没有就重建或者在主题目录下修改)中添加下列代码:

 1<style>
 2  :root {
 3    --sys-font-family: "Noto Serif SC";
 4    --zh-font-family: "Noto Serif SC";
 5    --base-font-family: "Noto Serif SC";
 6    --code-font-family: "Noto Serif SC";
 7    --article-font-family: "Noto Serif SC";
 8  }
 9</style>
10
11<script>
12  (function () {
13    const customFont = document.createElement("link");
14    customFont.href =
15      "https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&display=swap";
16
17    customFont.type = "text/css";
18    customFont.rel = "stylesheet";
19
20    document.head.appendChild(customFont);
21  })();
22</script>

具体的改的有点杂乱,等捋顺思路在添加内容

Licensed under CC BY-NC-SA 4.0
/* */