修复第三方封面图

This commit is contained in:
tangly1024
2022-03-27 17:54:46 +08:00
parent 9d0b8482b8
commit 3034b41590
6 changed files with 9 additions and 8 deletions

View File

@@ -79,7 +79,7 @@ const BLOG = {
ADSENSE_GOOGLE_ID: process.env.NEXT_PUBLIC_ADSENSE_GOOGLE_ID || '', // 谷歌广告ID e.g ca-pub-xxxxxxxxxxxxxxxx
isProd: process.env.VERCEL_ENV === 'production', // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables) isProd: process.env.VERCEL_ENV === 'production' // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables)
VERSION: '2.8.2' // 版本号
VERSION: '2.8.3' // 版本号
}
module.exports = BLOG

View File

@@ -83,6 +83,7 @@ export async function getNotionPageData ({ pageId, from }) {
const pageRecordMap = await getPageRecordMapByNotionAPI({ pageId, from })
// 存入缓存
if (pageRecordMap) {
console.log('[站点数据]', pageRecordMap)
await setDataToCache(cacheKey, pageRecordMap)
}
return pageRecordMap

View File

@@ -3,7 +3,7 @@ module.exports = {
webpack5: true
},
images: {
domains: ['gravatar.com', 'www.notion.so', 'avatars.githubusercontent.com']
domains: ['gravatar.com', 'www.notion.so', 'avatars.githubusercontent.com', 'images.unsplash.com'] // 允许next/image加载的图片 域名
},
async headers () {
return [

View File

@@ -1,6 +1,6 @@
{
"name": "notion-next",
"version": "2.8.2",
"version": "2.8.3",
"homepage": "https://github.com/tangly1024/NotionNext.git",
"license": "MIT",
"repository": {

View File

@@ -1,5 +1,4 @@
import BLOG from '@/blog.config'
import Image from 'next/image'
import Link from 'next/link'
import React from 'react'
import CONFIG_FUKA from '../config_fuka'
@@ -26,7 +25,9 @@ const BlogCard = ({ post, showSummary }) => {
{CONFIG_FUKA.POST_LIST_COVER && post?.page_cover && (
<Link href={`${BLOG.PATH}/article/${post.slug}`} passHref>
<div className='h-40 w-full relative duration-200 cursor-pointer transform overflow-hidden'>
<Image className='hover:scale-105 transform duration-500' src={post?.page_cover} alt={post.title} layout='fill' objectFit='cover' loading='lazy' />
{/* eslint-disable-next-line @next/next/no-img-element */}
<img src={post?.page_cover} alt={post.title} className='hover:scale-125 transform duration-500'></img>
{/* <Image className='hover:scale-105 transform duration-500' src={post?.page_cover} alt={post.title} layout='fill' objectFit='cover' loading='lazy' /> */}
</div>
</Link>
)}

View File

@@ -1,5 +1,4 @@
import BLOG from '@/blog.config'
import Image from 'next/image'
import Link from 'next/link'
import React from 'react'
import { Code, Collection, CollectionRow, Equation, NotionRenderer } from 'react-notion-x'
@@ -60,8 +59,8 @@ const BlogPostCard = ({ post, showSummary }) => {
<Link href={`${BLOG.PATH}/article/${post.slug}`} passHref>
<a className='w-full relative duration-200 rounded-t-xl lg:rounded-r-xl lg:rounded-t-none cursor-pointer transform overflow-hidden'>
{/* eslint-disable-next-line @next/next/no-img-element */}
{/* <img src={post?.page_cover} alt={post.title} className='h-full object-cover'></img> */}
<Image className='hover:scale-125 rounded-t-xl lg:rounded-r-xl lg:rounded-t-none transform duration-500' src={post?.page_cover} alt={post.title} layout='fill' objectFit='cover' loading='lazy' />
<img src={post?.page_cover} alt={post.title} className='hover:scale-125 rounded-t-xl lg:rounded-r-xl lg:rounded-t-none transform duration-500'></img>
{/* <Image className='hover:scale-125 rounded-t-xl lg:rounded-r-xl lg:rounded-t-none transform duration-500' src={post?.page_cover} alt={post.title} layout='fill' objectFit='cover' loading='lazy' /> */}
</a>
</Link>
)}