Skip to content

Commit

Permalink
Update blog configuration and remove preview images
Browse files Browse the repository at this point in the history
  • Loading branch information
robinv8 committed Jan 2, 2024
1 parent 2c78fa9 commit d7b3d53
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
6 changes: 3 additions & 3 deletions blog.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const BLOG = {
title: 'robin blog',
title: 'robin 的博客',
author: 'robin',
email: 'robin@rnode.me',
link: 'https://blog.robin.me',
newsletter: 'Weekly',
description: 'robin blog',
description: '记录生活,记录成长',
lang: 'zh-CN', // ['en-US', 'zh-CN', 'zh-HK', 'zh-TW', 'ja-JP', 'es-ES']
timezone: 'Asia/Shanghai', // See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for all options.
appearance: 'auto', // ['light', 'dark', 'auto'],
Expand All @@ -24,7 +24,7 @@ const BLOG = {
friends: true
},
showWeChatPay: false,
previewImagesEnabled: true,
previewImagesEnabled: false,
autoCollapsedNavBar: false, // The automatically collapsed navigation bar
ogImageGenerateHost: 'og-zl.vercel.app', // The link to generate OG image, don't end with a slash
defaultCover: '/cover.jpg',
Expand Down
7 changes: 1 addition & 6 deletions components/BlogPost.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ const BlogPost = ({ post }) => {
key={post.id}
className='group flex flex-col overflow-hidden relative mb-5 md:mb-8 cursor-pointer rounded-xl p-5'
>
<Image
fill
alt={`${post.title}`}
src={post?.page_cover}
className='w-full h-full object-cover object-center absolute inset-0 group-hover:scale-110 transition duration-200'
/>

<div className='hidden md:block md-cover absolute inset-0'></div>
<div className='md:hidden sm-cover absolute inset-0'></div>
<div className='relative mt-auto'>
Expand Down
12 changes: 7 additions & 5 deletions lib/notion/getPostBlocks.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import BLOG from '@/blog.config'
import { NotionAPI } from 'notion-client'
import { getPreviewImageMap } from './previewImages'
// import { getPreviewImageMap } from './previewImages'

export async function getPostBlocks(id) {
const authToken = BLOG.notionAccessToken || null
const api = new NotionAPI({ authToken })
const pageBlock = await api.getPage(id)
if (BLOG.previewImagesEnabled) {
const previewImageMap = await getPreviewImageMap(pageBlock)
pageBlock.preview_images = previewImageMap
}

// TODO: 暂时不需要预览图
// if (BLOG.previewImagesEnabled) {
// const previewImageMap = await getPreviewImageMap(pageBlock)
// pageBlock.preview_images = previewImageMap
// }
return pageBlock
}
4 changes: 2 additions & 2 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ nav {
}

.md-cover {
@apply bg-gradient-to-r from-gray-100 to-gray-100 group-hover:from-gray-200 group-hover:via-gray-200 dark:from-gray-700 dark:to-gray-700 dark:group-hover:from-gray-600 dark:group-hover:via-gray-600 group-hover:to-transparent;
@apply bg-gradient-to-r from-gray-100 to-gray-100 dark:from-gray-700 dark:to-gray-700
}

.sm-cover {
@apply bg-gradient-to-r from-gray-100 via-gray-100 group-hover:from-gray-200 group-hover:via-gray-200 dark:from-gray-700 dark:via-gray-700 dark:group-hover:from-gray-600 dark:group-hover:via-gray-600 to-transparent;
@apply bg-gradient-to-r from-gray-100 to-gray-100 dark:from-gray-700 dark:to-gray-700
}

0 comments on commit d7b3d53

Please sign in to comment.