mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
🕶 尝试优化首页打开评分
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
import BLOG from '@/blog.config'
|
||||
import Head from 'next/head'
|
||||
|
||||
const CommonHead = ({ meta }) => {
|
||||
const url = BLOG.path.length ? `${BLOG.link}/${BLOG.path}` : BLOG.link
|
||||
|
||||
return <Head>
|
||||
<title>{meta.title}</title>
|
||||
<meta content={BLOG.darkBackground} name='theme-color' />
|
||||
<meta name='robots' content='follow, index' />
|
||||
<meta charSet='UTF-8' />
|
||||
{BLOG.seo.googleSiteVerification && (
|
||||
<meta
|
||||
name='google-site-verification'
|
||||
content={BLOG.seo.googleSiteVerification}
|
||||
/>
|
||||
)}
|
||||
{BLOG.seo.keywords && (
|
||||
<meta name='keywords' content={BLOG.seo.keywords.join(', ')} />
|
||||
)}
|
||||
<meta name='description' content={meta.description} />
|
||||
<meta property='og:locale' content={BLOG.lang} />
|
||||
<meta property='og:title' content={meta.title} />
|
||||
<meta property='og:description' content={meta.description} />
|
||||
<meta
|
||||
property='og:url'
|
||||
content={meta.slug ? `${url}/${meta.slug}` : url}
|
||||
/>
|
||||
<meta property='og:type' content={meta.type} />
|
||||
<meta name='twitter:card' content='summary_large_image' />
|
||||
<meta name='twitter:description' content={meta.description} />
|
||||
<meta name='twitter:title' content={meta.title} />
|
||||
{meta.type === 'article' && (
|
||||
<>
|
||||
<meta
|
||||
property='article:published_time'
|
||||
content={meta.date || meta.createdTime}
|
||||
/>
|
||||
<meta property='article:author' content={BLOG.author} />
|
||||
</>
|
||||
)}
|
||||
</Head>
|
||||
}
|
||||
|
||||
export default CommonHead
|
||||
@@ -4,7 +4,6 @@ import BLOG from '@/blog.config'
|
||||
import formatDate from '@/lib/formatDate'
|
||||
import 'gitalk/dist/gitalk.css'
|
||||
import Comment from '@/components/Comment'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import Progress from '@/components/Progress'
|
||||
import { useRef } from 'react'
|
||||
import Image from 'next/image'
|
||||
@@ -15,6 +14,7 @@ import BlogPostMini from '@/components/BlogPostMini'
|
||||
import { useRouter } from 'next/router'
|
||||
import ShareButton from '@/components/ShareButton'
|
||||
import TopJumper from '@/components/TopJumper'
|
||||
import { Head } from 'next/document'
|
||||
|
||||
const mapPageUrl = id => {
|
||||
return 'https://www.notion.so/' + id.replace(/-/g, '')
|
||||
@@ -37,9 +37,30 @@ const ArticleLayout = ({
|
||||
const targetRef = useRef(null)
|
||||
const { theme } = useTheme()
|
||||
const url = BLOG.link + useRouter().asPath
|
||||
|
||||
return (
|
||||
<div className={`${BLOG.font} ${theme}`}>
|
||||
<CommonHead meta={meta} />
|
||||
<Head>
|
||||
<title>{meta.title}</title>
|
||||
<meta name='description' content={meta.description} />
|
||||
<meta property='og:title' content={meta.title} />
|
||||
<meta property='og:description' content={meta.description} />
|
||||
<meta
|
||||
property='og:url'
|
||||
content={meta.slug ? `${url}/${meta.slug}` : url}
|
||||
/>
|
||||
<meta property='og:type' content={meta.type} />
|
||||
{meta.type === 'article' && (
|
||||
<>
|
||||
<meta
|
||||
property='article:published_time'
|
||||
content={meta.date || meta.createdTime}
|
||||
/>
|
||||
<meta property='article:author' content={BLOG.author} />
|
||||
</>
|
||||
)}
|
||||
</Head>
|
||||
|
||||
{/* live2d 看板娘 */}
|
||||
<script async src='https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/autoload.js' />
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import BlogPost from '@/components/BlogPost'
|
||||
import PropTypes from 'prop-types'
|
||||
import Pagination from '@/components/Pagination'
|
||||
import BLOG from '@/blog.config'
|
||||
import CommonHead from '@/components/CommonHead'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useTheme } from '@/lib/theme'
|
||||
import { useEffect, useState } from 'react'
|
||||
@@ -10,11 +9,6 @@ import SideBar from '@/components/SideBar'
|
||||
import throttle from 'lodash.throttle'
|
||||
|
||||
const DefaultLayout = ({ tags, posts, page, currentTag, ...customMeta }) => {
|
||||
const meta = {
|
||||
title: BLOG.title,
|
||||
type: 'website',
|
||||
...customMeta
|
||||
}
|
||||
page = page ?? 1
|
||||
let postsToShow = []
|
||||
let filteredBlogPosts = posts ?? []
|
||||
@@ -64,20 +58,19 @@ const DefaultLayout = ({ tags, posts, page, currentTag, ...customMeta }) => {
|
||||
changeColumn(4)
|
||||
} else if (window.innerWidth > 1300) {
|
||||
changeColumn(3)
|
||||
} else if (window.innerWidth < 768) {
|
||||
changeColumn(1)
|
||||
} else {
|
||||
} else if (window.innerWidth > 900) {
|
||||
changeColumn(2)
|
||||
} else if (window.innerWidth < 900) {
|
||||
changeColumn(1)
|
||||
}
|
||||
}, 500)
|
||||
|
||||
const [column, changeColumn] = useState(1)
|
||||
const [column, changeColumn] = useState(3)
|
||||
|
||||
const { theme } = useTheme()
|
||||
|
||||
return (
|
||||
<div id='wrapper' className={theme}>
|
||||
<CommonHead meta={meta} />
|
||||
{/* <TopNav tags={tags} currentTag={currentTag} /> */}
|
||||
{/* <Header navBarTitle={meta.title} fullWidth={true}/> */}
|
||||
|
||||
@@ -112,11 +105,11 @@ const DefaultLayout = ({ tags, posts, page, currentTag, ...customMeta }) => {
|
||||
)}
|
||||
|
||||
{/* 文章列表 */}
|
||||
<div className='mx-auto animate__animated animate__fadeIn'>
|
||||
<div className='mx-auto'>
|
||||
{/* <div className='col-4 grid md:grid-cols-2 grid-cols-1 gap-6'> */}
|
||||
<div style={{ columnCount: column }} className=''>
|
||||
<div style={{ columnCount: column }}>
|
||||
{!postsToShow.length && (
|
||||
<p className='text-gray-500 dark:text-gray-300 textc'>No posts found.</p>
|
||||
<p className='text-gray-500 dark:text-gray-300'>No posts found.</p>
|
||||
)}
|
||||
{postsToShow.map(post => (
|
||||
<BlogPost key={post.id} post={post} tags={tags} />
|
||||
|
||||
@@ -14,6 +14,20 @@ class MyDocument extends Document {
|
||||
<Head>
|
||||
<link rel='icon' href='/favicon.ico' />
|
||||
<link rel='icon' href='/favicon.svg' type='image/svg+xml' />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
|
||||
<meta property='og:locale' content={BLOG.lang} />
|
||||
<meta content={BLOG.darkBackground} name='theme-color' />
|
||||
<meta name='robots' content='follow, index' />
|
||||
<meta charSet='UTF-8' />
|
||||
{BLOG.seo.googleSiteVerification && (
|
||||
<meta
|
||||
name='google-site-verification'
|
||||
content={BLOG.seo.googleSiteVerification}
|
||||
/>
|
||||
)}
|
||||
{BLOG.seo.keywords && (
|
||||
<meta name='keywords' content={BLOG.seo.keywords.join(', ')} />
|
||||
)}
|
||||
<ThirdPartyScript />
|
||||
</Head>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user