Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
robinv8 committed Jan 2, 2025
1 parent 0daa56b commit 6491b57
Showing 1 changed file with 68 additions and 55 deletions.
123 changes: 68 additions & 55 deletions pages/_document.js
Original file line number Diff line number Diff line change
@@ -1,60 +1,73 @@
import Document, { Html, Head, Main, NextScript } from 'next/document'
import BLOG from '@/blog.config'
import Document, { Html, Head, Main, NextScript } from "next/document";
import BLOG from "@/blog.config";

class MyDocument extends Document {
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx)
return { ...initialProps }
}
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx);
return { ...initialProps };
}

render() {
return (
<Html lang={BLOG.lang}>
<Head>
<link rel='icon' href='/favicon.ico' />
<link rel='icon' href='/avatar.webp' type='image/webp' />
<link
rel='apple-touch-icon'
sizes='192x192'
href='/favicon.png'
></link>
<link
rel='alternate'
type='application/rss+xml'
title='RSS 2.0'
href='/feed'
></link>
{BLOG.appearance === 'auto' ? (
<>
<meta
name='theme-color'
content={BLOG.lightBackground}
media='(prefers-color-scheme: light)'
/>
<meta
name='theme-color'
content={BLOG.darkBackground}
media='(prefers-color-scheme: dark)'
/>
</>
) : (
<meta
name='theme-color'
content={
BLOG.appearance === 'dark'
? BLOG.darkBackground
: BLOG.lightBackground
}
/>
)}
</Head>
<body className='bg-day dark:bg-night'>
<Main />
<NextScript />
</body>
</Html>
)
}
render() {
return (
<Html lang={BLOG.lang}>
<Head>
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href="/avatar.webp" type="image/webp" />
<link
rel="apple-touch-icon"
sizes="192x192"
href="/favicon.png"
></link>
<link
rel="alternate"
type="application/rss+xml"
title="RSS 2.0"
href="/feed"
></link>
{BLOG.appearance === "auto" ? (
<>
<meta
name="theme-color"
content={BLOG.lightBackground}
media="(prefers-color-scheme: light)"
/>
<meta
name="theme-color"
content={BLOG.darkBackground}
media="(prefers-color-scheme: dark)"
/>
</>
) : (
<meta
name="theme-color"
content={
BLOG.appearance === "dark"
? BLOG.darkBackground
: BLOG.lightBackground
}
/>
)}
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-X24FHE7LJL"
/>
<script
dangerouslySetInnerHTML={{
__html: ` window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-X24FHE7LJL');`,
}}
/>
</Head>
<body className="bg-day dark:bg-night">
<Main />
<NextScript />
</body>
</Html>
);
}
}

export default MyDocument
export default MyDocument;

0 comments on commit 6491b57

Please sign in to comment.