summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-11-01 09:29:22 +0800
committerEltrac <hi@guhub.cn>2025-11-01 09:29:22 +0800
commit1383cc5caa7a4b2ebc0da4eeb94046538ff8813f (patch)
treec2be0e90826cf3b19e17b8c8dd997c4e6db56818
parent3fef3e5dbaed106ea4dada366e92b583c1b73b74 (diff)
perf: remove Google Fonts
-rw-r--r--assets/css/utils/_variables.scss15
-rw-r--r--content/_drafts/53.md21
-rw-r--r--layouts/_partials/head/css.html9
3 files changed, 30 insertions, 15 deletions
diff --git a/assets/css/utils/_variables.scss b/assets/css/utils/_variables.scss
index 1d70cd7a..0bea0c5d 100644
--- a/assets/css/utils/_variables.scss
+++ b/assets/css/utils/_variables.scss
@@ -10,7 +10,16 @@
--bright-background-color: #fafafa;
/* fonts */
- --serif-font-family: "Noto Serif", "Noto Serif SC", serif;
+ --serif-font-family:
+ "Noto Serif",
+ "Noto Serif SC",
+ "Noto Serif TC",
+ "Source Han Serif SC",
+ "Source Han Serif TC",
+ "Songti SC",
+ "Times New Roman",
+ Times,
+ serif;
--page-width: 650px;
--page-margin-y: 5rem;
@@ -23,10 +32,6 @@
--pagefind-ui-tag: var(--border-color);
}
-html[lang="en-US"] {
- --serif-font-family: "Playfair Display", serif;
-}
-
@mixin variablesInDarkMode {
--background-color: #1d2021;
--block-background-color: rgb(var(--block-background-color-rgb));
diff --git a/content/_drafts/53.md b/content/_drafts/53.md
index c6b12652..31a86504 100644
--- a/content/_drafts/53.md
+++ b/content/_drafts/53.md
@@ -61,6 +61,25 @@ toc: true
## ↯ · 当下
+### 博客的改动
+
+1. 移除了 Google Fonts。透过 PageSpeed Insight 发现网站有一大半的性能问题都是引用了外部字体导致的。如果想要更好的阅读体验,可以手动在电脑上安装 [Noto Serif](https://fonts.google.com/noto/specimen/Noto+Serif) 和 [Noto Serif SC](https://fonts.google.com/noto/specimen/Noto+Serif+SC?query=Noto+serif+SC) 字体。
+
+ 现在添加了更多的回落字体(fallback),具体代码如下。
+
+ ```css
+ --serif-font-family:
+ "Noto Serif",
+ "Noto Serif SC",
+ "Noto Serif TC",
+ "Source Han Serif SC",
+ "Source Han Serif TC",
+ "Songti SC",
+ "Times New Roman",
+ Times,
+ serif;
+ ```
+
### 看《地狱客栈》第二季
-### 观影《即兴谋杀》 \ No newline at end of file
+### 观影《即兴谋杀》
diff --git a/layouts/_partials/head/css.html b/layouts/_partials/head/css.html
index 250ef4a3..f7fa9a9c 100644
--- a/layouts/_partials/head/css.html
+++ b/layouts/_partials/head/css.html
@@ -1,12 +1,3 @@
-<!-- Google Fonts -->
-<link rel="preconnect" href="https://fonts.googleapis.com">
-<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
-{{ if eq .Site.Language.Lang "zh" }}
-<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@200..900&family=Noto+Serif:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
-{{ else }}
-<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap" rel="stylesheet">
-{{ end }}
-
<!-- Aplayer -->
{{ with resources.Get "css/aplayer.css" }}
<style>{{ .Content | safeCSS }}</style>