mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-20 15:09:40 +00:00
SEO 优化首屏加载体积
This commit is contained in:
@@ -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>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user