diff --git a/components/CommonHead.js b/components/CommonHead.js
index fcc4981f..f4f9a772 100644
--- a/components/CommonHead.js
+++ b/components/CommonHead.js
@@ -16,56 +16,66 @@ const CommonHead = ({ meta, children }) => {
const category = meta?.category || BLOG.KEYWORDS || '軟體科技' // section 主要是像是 category 這樣的分類,Facebook 用這個來抓連結的分類
return (
-
- {title}
-
-
-
-
- {BLOG.SEO_GOOGLE_SITE_VERIFICATION && (
-
- )}
- {BLOG.SEO_BAIDU_SITE_VERIFICATION && ()}
-
-
-
-
-
-
-
-
-
-
-
-
+
+ {title}
+
+
+
+
+ {BLOG.SEO_GOOGLE_SITE_VERIFICATION && (
+
+ )}
+ {BLOG.SEO_BAIDU_SITE_VERIFICATION && ()}
+
+
+
+
+
+
+
+
+
+
+
+
- {BLOG.COMMENT_WEBMENTION.ENABLE && (
- <>
-
-
- >
- )}
- {BLOG.COMMENT_WEBMENTION.ENABLE && BLOG.COMMENT_WEBMENTION.AUTH !== '' && (
-
- )}
+ {/* 预加载字体 */}
+ {BLOG.FONT_AWESOME && <>
+
+
+ >}
+ {BLOG.FONT_URL?.map((fontUrl, index) => {
+ return
+ })}
- {JSON.parse(BLOG.ANALYTICS_BUSUANZI_ENABLE) && }
- {meta?.type === 'Post' && (
- <>
-
-
-
-
- >
- )}
- {children}
-
+ {BLOG.COMMENT_WEBMENTION.ENABLE && (
+ <>
+
+
+ >
+ )}
+
+ {BLOG.COMMENT_WEBMENTION.ENABLE && BLOG.COMMENT_WEBMENTION.AUTH !== '' && (
+
+ )}
+
+ {JSON.parse(BLOG.ANALYTICS_BUSUANZI_ENABLE) && }
+ {meta?.type === 'Post' && (
+ <>
+
+
+
+
+ >
+ )}
+ {children}
+
)
}
diff --git a/components/ExternalScript.js b/components/ExternalScript.js
index f10efa72..62b6e95c 100644
--- a/components/ExternalScript.js
+++ b/components/ExternalScript.js
@@ -10,7 +10,6 @@ import { isBrowser, loadExternalResource } from '@/lib/utils'
const ExternalScript = () => {
if (isBrowser()) {
// 静态导入本地自定义样式
- loadExternalResource(BLOG.FONT_AWESOME, 'css')
loadExternalResource('/css/custom.css', 'css')
loadExternalResource('/js/custom.js', 'js')
@@ -29,10 +28,6 @@ const ExternalScript = () => {
loadExternalResource(url, 'css')
}
}
- // 渲染所有字体
- BLOG.FONT_URL?.forEach(e => {
- loadExternalResource(e, 'font')
- })
}
return null
}
diff --git a/components/LazyImage.js b/components/LazyImage.js
index cf78ba5d..28b48ef8 100644
--- a/components/LazyImage.js
+++ b/components/LazyImage.js
@@ -1,18 +1,19 @@
+import Head from 'next/head'
import React, { useEffect, useRef, useState } from 'react'
/**
* 默认懒加载占位图
*/
const loadingSVG = (
-
+
)
/**
@@ -42,17 +43,6 @@ export default function LazyImage({
}
}
- // 预加载图片
- useEffect(() => {
- if (priority) {
- const link = document.createElement('link')
- link.rel = 'preload'
- link.as = 'image'
- link.href = src
- document.head.appendChild(link)
- }
- }, [priority, src])
-
useEffect(() => {
const observer = new IntersectionObserver(
(entries) => {
@@ -103,8 +93,12 @@ export default function LazyImage({
if (style) {
imgProps.style = style
}
- return (
- // eslint-disable-next-line @next/next/no-img-element
-
- )
+ return (<>
+ {/* eslint-disable-next-line @next/next/no-img-element */}
+
+ {/* 预加载 */}
+ {priority &&
+
+ }
+ >)
}
diff --git a/pages/_app.js b/pages/_app.js
index 650158b6..a6a11399 100644
--- a/pages/_app.js
+++ b/pages/_app.js
@@ -29,7 +29,7 @@ const MyApp = ({ Component, pageProps }) => {
return (
-
+
)