SEO 优化首屏加载体积

This commit is contained in:
tangly1024.com
2023-12-01 18:38:24 +08:00
parent fc04a01356
commit c20ad9973e
23 changed files with 174 additions and 83 deletions

View File

@@ -1,29 +1,21 @@
import { siteConfig } from '@/lib/config'
import { useRouter } from 'next/router'
import React from 'react'
import ShareButtons from './ShareButtons'
import dynamic from 'next/dynamic'
const ShareButtons = dynamic(() => import('@/components/ShareButtons'), { ssr: false })
/**
* 分享栏
* @param {} param0
* @returns
*/
const ShareBar = ({ post }) => {
const router = useRouter()
const title = siteConfig('TITLE')
if (!JSON.parse(siteConfig('POST_SHARE_BAR_ENABLE')) || !post || post?.type !== 'Post') {
return <></>
}
const shareUrl = siteConfig('LINK') + router.asPath
return <div className='m-1 overflow-x-auto'>
<div className='flex w-full md:justify-end'>
<ShareButtons shareUrl={shareUrl} title={post.title} image={post.pageCover} body={
post?.title +
' | ' +
title +
' ' +
shareUrl +
' ' +
post?.summary
} />
<ShareButtons post={post} />
</div>
</div>
}