mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-02 15:10:16 +00:00
多语言配置,starter主题微调、兼容
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// eslint-disable-next-line @next/next/no-document-import-in-page
|
||||
import Document, { Html, Head, Main, NextScript } from 'next/document'
|
||||
import BLOG from '@/blog.config'
|
||||
import Document, { Head, Html, Main, NextScript } from 'next/document'
|
||||
|
||||
class MyDocument extends Document {
|
||||
static async getInitialProps(ctx) {
|
||||
@@ -10,29 +10,52 @@ class MyDocument extends Document {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Html lang={BLOG.LANG}>
|
||||
<Head>
|
||||
<link rel='icon' href= {`${BLOG.BLOG_FAVICON}`} />
|
||||
{/* 预加载字体 */}
|
||||
{BLOG.FONT_AWESOME && <>
|
||||
<link rel='preload' href={BLOG.FONT_AWESOME} as="style" crossOrigin="anonymous" />
|
||||
<link rel="stylesheet" href={BLOG.FONT_AWESOME} crossOrigin="anonymous" referrerPolicy="no-referrer" />
|
||||
</>}
|
||||
<Html lang={BLOG.LANG}>
|
||||
<Head>
|
||||
<link rel='icon' href={`${BLOG.BLOG_FAVICON}`} />
|
||||
{/* 预加载字体 */}
|
||||
{BLOG.FONT_AWESOME && (
|
||||
<>
|
||||
<link
|
||||
rel='preload'
|
||||
href={BLOG.FONT_AWESOME}
|
||||
as='style'
|
||||
crossOrigin='anonymous'
|
||||
/>
|
||||
<link
|
||||
rel='stylesheet'
|
||||
href={BLOG.FONT_AWESOME}
|
||||
crossOrigin='anonymous'
|
||||
referrerPolicy='no-referrer'
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{BLOG.FONT_URL?.map((fontUrl, index) => {
|
||||
if (fontUrl.endsWith('.css') || fontUrl.includes('googleapis.com/css')) {
|
||||
return <link key={index} rel="stylesheet" href={fontUrl} />
|
||||
} else {
|
||||
return <link key={index} rel="preload" href={fontUrl} as="font" type="font/woff2" />
|
||||
}
|
||||
})}
|
||||
</Head>
|
||||
{BLOG.FONT_URL?.map((fontUrl, index) => {
|
||||
if (
|
||||
fontUrl.endsWith('.css') ||
|
||||
fontUrl.includes('googleapis.com/css')
|
||||
) {
|
||||
return <link key={index} rel='stylesheet' href={fontUrl} />
|
||||
} else {
|
||||
return (
|
||||
<link
|
||||
key={index}
|
||||
rel='preload'
|
||||
href={fontUrl}
|
||||
as='font'
|
||||
type='font/woff2'
|
||||
/>
|
||||
)
|
||||
}
|
||||
})}
|
||||
</Head>
|
||||
|
||||
<body>
|
||||
<Main />
|
||||
<NextScript />
|
||||
</body>
|
||||
</Html>
|
||||
<body>
|
||||
<Main />
|
||||
<NextScript />
|
||||
</body>
|
||||
</Html>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user