From d93f08fe1181ac7d7ef41de0c334e5515171eee0 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 3 Feb 2023 13:09:37 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=85=81=E8=AE=B8=E5=B0=81=E9=9D=A2?= =?UTF-8?q?=E5=9B=BE=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getNotionData.js | 25 +++++++++---------- lib/notion/getPageProperties.js | 4 +-- themes/fukasawa/components/BlogCard.js | 14 ++++++++--- themes/fukasawa/components/BlogListPage.js | 4 +-- themes/fukasawa/components/BlogListScroll.js | 10 +++----- themes/hexo/components/BlogPostCard.js | 2 +- themes/matery/components/BlogPostCard.js | 9 +++++-- themes/matery/components/BlogPostListPage.js | 4 +-- .../matery/components/BlogPostListScroll.js | 4 +-- 9 files changed, 42 insertions(+), 34 deletions(-) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index 80444cdb..683754b1 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -27,11 +27,15 @@ export async function getGlobalNotionData({ // 获取Notion数据 const notionPageData = deepClone(await getNotionPageData({ pageId, from })) delete notionPageData.block - delete notionPageData.collection - delete notionPageData.collectionQuery delete notionPageData.schema delete notionPageData.rawMetadata delete notionPageData.pageIds + delete notionPageData.viewIds + delete notionPageData.collection + delete notionPageData.collectionQuery + delete notionPageData.collectionId + delete notionPageData.collectionView + return notionPageData } @@ -192,12 +196,10 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) { const collectionQuery = pageRecordMap.collection_query const collectionView = pageRecordMap.collection_view const schema = collection?.schema - const tagOptions = getTagOptions(schema) - const categoryOptions = getCategoryOptions(schema) + const viewIds = rawMetadata?.view_ids const collectionData = [] const pageIds = getAllPageIds(collectionQuery, collectionId, collectionView, viewIds) - const siteInfo = getBlogInfo({ collection, block }) if (pageIds?.length === 0) { console.error('获取到的文章列表为空,请检查notion模板', collectionQuery, collection, collectionView, viewIds, pageRecordMap) } @@ -207,15 +209,12 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) { if (!value) { continue } - const properties = (await getPageProperties(id, block, schema, null, tagOptions, siteInfo)) || null + const properties = (await getPageProperties(id, block, schema, null, getTagOptions(schema))) || null if (properties) { collectionData.push(properties) } } - // 获取page作为自定义菜单 - const customNav = getCustomNav({ allPages: collectionData.filter(post => post.type === 'Page' && post.status === 'Published') }) - // 文章计数 let postCount = 0 const allPages = collectionData.filter(post => { @@ -238,8 +237,10 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) { }) } - const categories = getAllCategories({ allPages, categoryOptions, sliceCount: BLOG.PREVIEW_CATEGORY_COUNT }) - const tags = getAllTags({ allPages, sliceCount: BLOG.PREVIEW_TAG_COUNT, tagOptions }) + const categoryOptions = getAllCategories({ allPages, categoryOptions: getCategoryOptions(schema), sliceCount: BLOG.PREVIEW_CATEGORY_COUNT }) + const tagOptions = getAllTags({ allPages, sliceCount: BLOG.PREVIEW_TAG_COUNT, tagOptions: getTagOptions(schema) }) + const siteInfo = getBlogInfo({ collection, block }) + const customNav = getCustomNav({ allPages: collectionData.filter(post => post.type === 'Page' && post.status === 'Published') }) const latestPosts = getLatestPosts({ allPages, from, latestPostCount: 5 }) return { @@ -258,8 +259,6 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) { customNav, postCount, pageIds, - categories, - tags, latestPosts } } diff --git a/lib/notion/getPageProperties.js b/lib/notion/getPageProperties.js index 6079ce51..b498fd82 100644 --- a/lib/notion/getPageProperties.js +++ b/lib/notion/getPageProperties.js @@ -6,7 +6,7 @@ import { defaultMapImageUrl } from 'react-notion-x' // import { createHash } from 'crypto' import md5 from 'js-md5' -export default async function getPageProperties(id, block, schema, authToken, tagOptions, siteInfo) { +export default async function getPageProperties(id, block, schema, authToken, tagOptions) { const rawProperties = Object.entries(block?.[id]?.value?.properties || []) const excludeProperties = ['date', 'select', 'multi_select', 'person'] const value = block[id]?.value @@ -89,7 +89,7 @@ export default async function getPageProperties(id, block, schema, authToken, ta properties.lastEditedTime = formatDate(new Date(value?.last_edited_time).toString(), BLOG.LANG) properties.fullWidth = value.format?.page_full_width ?? false properties.pageIcon = getImageUrl(block[id].value?.format?.page_icon, block[id].value) ?? '' - properties.page_cover = getImageUrl(block[id].value?.format?.page_cover, block[id].value) ?? siteInfo?.pageCover + properties.page_cover = getImageUrl(block[id].value?.format?.page_cover, block[id].value) ?? '' properties.content = value.content ?? [] properties.password = properties.password ? md5(properties.slug + properties.password) diff --git a/themes/fukasawa/components/BlogCard.js b/themes/fukasawa/components/BlogCard.js index 1c42923f..328176ce 100644 --- a/themes/fukasawa/components/BlogCard.js +++ b/themes/fukasawa/components/BlogCard.js @@ -4,8 +4,14 @@ import React from 'react' import CONFIG_FUKA from '../config_fuka' import Card from './Card' -const BlogCard = ({ post, showSummary }) => { +const BlogCard = ({ post, showSummary, siteInfo }) => { const showPreview = CONFIG_FUKA.POST_LIST_PREVIEW && post.blockMap + // matery 主题默认强制显示图片 + if (post && !post.page_cover) { + post.page_cover = siteInfo?.pageCover + } + const showPageCover = CONFIG_FUKA.POST_LIST_COVER && post?.page_cover + return (
{ )}
- {CONFIG_FUKA.POST_LIST_COVER && post?.page_cover && ( + {showPageCover && (
{/* eslint-disable-next-line @next/next/no-img-element */} {post.title} {/* {post.title} */}
@@ -45,7 +51,7 @@ const BlogCard = ({ post, showSummary }) => { )}
- ); + ) } export default BlogCard diff --git a/themes/fukasawa/components/BlogListPage.js b/themes/fukasawa/components/BlogListPage.js index 98dfedff..2f0af0df 100644 --- a/themes/fukasawa/components/BlogListPage.js +++ b/themes/fukasawa/components/BlogListPage.js @@ -12,7 +12,7 @@ import PaginationSimple from './PaginationSimple' * @returns {JSX.Element} * @constructor */ -const BlogListPage = ({ page = 1, posts = [], postCount }) => { +const BlogListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { const totalPage = Math.ceil(postCount / BLOG.POSTS_PER_PAGE) const showNext = page < totalPage const [colCount, changeCol] = useState(1) @@ -44,7 +44,7 @@ const BlogListPage = ({ page = 1, posts = [], postCount }) => {
{posts?.map(post => (
- +
))}
diff --git a/themes/fukasawa/components/BlogListScroll.js b/themes/fukasawa/components/BlogListScroll.js index 522d3f0e..003f789d 100644 --- a/themes/fukasawa/components/BlogListScroll.js +++ b/themes/fukasawa/components/BlogListScroll.js @@ -13,7 +13,7 @@ import throttle from 'lodash.throttle' * @constructor */ const BlogListScroll = props => { - const { posts = [] } = props + const { posts = [], siteInfo } = props const [colCount, changeCol] = React.useState(1) const { locale } = useGlobal() @@ -73,15 +73,13 @@ const BlogListScroll = props => {
{postsToShow?.map(post => (
- +
))}
-
+
{' '} {hasMore ? locale.COMMON.MORE : `${locale.COMMON.NO_MORE} 😰`}{' '}
diff --git a/themes/hexo/components/BlogPostCard.js b/themes/hexo/components/BlogPostCard.js index d0e9d1ee..819363fa 100644 --- a/themes/hexo/components/BlogPostCard.js +++ b/themes/hexo/components/BlogPostCard.js @@ -7,7 +7,7 @@ import NotionPage from '@/components/NotionPage' const BlogPostCard = ({ post, showSummary, index }) => { const showPreview = CONFIG_HEXO.POST_LIST_PREVIEW && post.blockMap - const showPageCover = CONFIG_HEXO.POST_LIST_COVER + const showPageCover = CONFIG_HEXO.POST_LIST_COVER && post?.page_cover return (
{ +const BlogPostCard = ({ post, showSummary, siteInfo }) => { const showPreview = CONFIG_MATERY.POST_LIST_PREVIEW && post.blockMap + // matery 主题默认强制显示图片 + if (post && !post.page_cover) { + post.page_cover = siteInfo.pageCover + } + const showPageCover = CONFIG_MATERY.POST_LIST_COVER && !showPreview && post?.page_cover return (
{
{/* 头部图片 填充卡片 */} - {CONFIG_MATERY.POST_LIST_COVER && !showPreview && post?.page_cover && ( + {showPageCover && (
{/* eslint-disable-next-line @next/next/no-img-element */} diff --git a/themes/matery/components/BlogPostListPage.js b/themes/matery/components/BlogPostListPage.js index 0a4eec12..2a458aea 100644 --- a/themes/matery/components/BlogPostListPage.js +++ b/themes/matery/components/BlogPostListPage.js @@ -11,7 +11,7 @@ import PaginationSimple from './PaginationSimple' * @returns {JSX.Element} * @constructor */ -const BlogPostListPage = ({ page = 1, posts = [], postCount }) => { +const BlogPostListPage = ({ page = 1, posts = [], postCount, siteInfo }) => { const totalPage = Math.ceil(postCount / BLOG.POSTS_PER_PAGE) const showPagination = postCount >= BLOG.POSTS_PER_PAGE if (!posts || posts.length === 0 || page > totalPage) { @@ -23,7 +23,7 @@ const BlogPostListPage = ({ page = 1, posts = [], postCount }) => { {/* 文章列表 */}
{posts.map(post => ( - + ))}
{showPagination && } diff --git a/themes/matery/components/BlogPostListScroll.js b/themes/matery/components/BlogPostListScroll.js index 9c243ade..105d32db 100644 --- a/themes/matery/components/BlogPostListScroll.js +++ b/themes/matery/components/BlogPostListScroll.js @@ -14,7 +14,7 @@ import { getListByPage } from '@/lib/utils' * @returns {JSX.Element} * @constructor */ -const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG_MATERY.POST_LIST_SUMMARY }) => { +const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG_MATERY.POST_LIST_SUMMARY, siteInfo }) => { const postsPerPage = BLOG.POSTS_PER_PAGE const [page, updatePage] = React.useState(1) const postsToShow = getListByPage(posts, page, postsPerPage) @@ -58,7 +58,7 @@ const BlogPostListScroll = ({ posts = [], currentSearch, showSummary = CONFIG_MA {/* 文章列表 */}
{postsToShow.map(post => ( - + ))}
From 3c280ddf5867fd435f23ef8cc4e5077725a5d266 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 3 Feb 2023 13:46:30 +0800 Subject: [PATCH 02/11] =?UTF-8?q?example=20=E4=B8=BB=E9=A2=98=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=20tag\category=20=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getNotionData.js | 2 +- pages/category/[category]/index.js | 6 +++--- pages/category/[category]/page/[page].js | 4 ++-- pages/category/index.js | 3 --- pages/tag/[tag]/index.js | 4 ++-- pages/tag/[tag]/page/[page].js | 4 ++-- pages/tag/index.js | 3 --- themes/example/LayoutCategoryIndex.js | 7 +++---- themes/example/LayoutTagIndex.js | 8 ++++---- themes/example/components/SideBar.js | 10 +++++----- themes/hexo/LayoutCategoryIndex.js | 4 ++-- themes/hexo/LayoutTag.js | 2 +- themes/hexo/LayoutTagIndex.js | 4 ++-- 13 files changed, 27 insertions(+), 34 deletions(-) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index 683754b1..f865d4ed 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -35,7 +35,7 @@ export async function getGlobalNotionData({ delete notionPageData.collectionQuery delete notionPageData.collectionId delete notionPageData.collectionView - + console.log(notionPageData) return notionPageData } diff --git a/pages/category/[category]/index.js b/pages/category/[category]/index.js index eaf8436a..583a69ab 100644 --- a/pages/category/[category]/index.js +++ b/pages/category/[category]/index.js @@ -58,10 +58,10 @@ export async function getStaticProps({ params: { category } }) { export async function getStaticPaths() { const from = 'category-paths' - const { categories } = await getGlobalNotionData({ from }) + const { categoryOptions } = await getGlobalNotionData({ from }) return { - paths: Object.keys(categories).map(category => ({ - params: { category: categories[category]?.name } + paths: Object.keys(categoryOptions).map(category => ({ + params: { category: categoryOptions[category]?.name } })), fallback: true } diff --git a/pages/category/[category]/page/[page].js b/pages/category/[category]/page/[page].js index 06b66a21..f01ae27a 100644 --- a/pages/category/[category]/page/[page].js +++ b/pages/category/[category]/page/[page].js @@ -53,10 +53,10 @@ export async function getStaticProps({ params: { category, page } }) { export async function getStaticPaths() { const from = 'category-paths' - const { categories, allPages } = await getGlobalNotionData({ from }) + const { categoryOptions, allPages } = await getGlobalNotionData({ from }) const paths = [] - categories?.forEach(category => { + categoryOptions?.forEach(category => { // 过滤状态类型 const categoryPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published').filter(post => post && post.category && post.category.includes(category.name)) // 处理文章页数 diff --git a/pages/category/index.js b/pages/category/index.js index 24653c8c..b310c188 100644 --- a/pages/category/index.js +++ b/pages/category/index.js @@ -2,7 +2,6 @@ import { getGlobalNotionData } from '@/lib/notion/getNotionData' import React from 'react' import { useGlobal } from '@/lib/global' import * as ThemeMap from '@/themes' -import { getAllCategories } from '@/lib/notion/getAllCategories' import BLOG from '@/blog.config' /** @@ -27,8 +26,6 @@ export default function Category(props) { export async function getStaticProps() { const props = await getGlobalNotionData({ from: 'category-index-props' }) - props.categories = getAllCategories({ allPages: props.allPages, categoryOptions: props.categoryOptions, sliceCount: 0 }) - delete props.categoryOptions delete props.allPages return { props, diff --git a/pages/tag/[tag]/index.js b/pages/tag/[tag]/index.js index 593bf555..f633c94f 100644 --- a/pages/tag/[tag]/index.js +++ b/pages/tag/[tag]/index.js @@ -63,8 +63,8 @@ function getTagNames(tags) { export async function getStaticPaths() { const from = 'tag-static-path' - const { tags } = await getGlobalNotionData({ from }) - const tagNames = getTagNames(tags) + const { tagOptions } = await getGlobalNotionData({ from }) + const tagNames = getTagNames(tagOptions) return { paths: Object.keys(tagNames).map(index => ({ diff --git a/pages/tag/[tag]/page/[page].js b/pages/tag/[tag]/page/[page].js index a21e46b4..788473b9 100644 --- a/pages/tag/[tag]/page/[page].js +++ b/pages/tag/[tag]/page/[page].js @@ -44,9 +44,9 @@ export async function getStaticProps({ params: { tag, page } }) { export async function getStaticPaths() { const from = 'tag-page-static-path' - const { tags, allPages } = await getGlobalNotionData({ from }) + const { tagOptions, allPages } = await getGlobalNotionData({ from }) const paths = [] - tags?.forEach(tag => { + tagOptions?.forEach(tag => { // 过滤状态类型 const tagPosts = allPages.filter(page => page.type === 'Post' && page.status === 'Published').filter(post => post && post.tags && post.tags.includes(tag.name)) // 处理文章页数 diff --git a/pages/tag/index.js b/pages/tag/index.js index cddba52a..e9263668 100644 --- a/pages/tag/index.js +++ b/pages/tag/index.js @@ -2,7 +2,6 @@ import { getGlobalNotionData } from '@/lib/notion/getNotionData' import React from 'react' import { useGlobal } from '@/lib/global' import * as ThemeMap from '@/themes' -import { getAllTags } from '@/lib/notion' import BLOG from '@/blog.config' /** @@ -28,8 +27,6 @@ const TagIndex = props => { export async function getStaticProps() { const from = 'tag-index-props' const props = await getGlobalNotionData({ from }) - props.tags = getAllTags({ allPages: props.allPages, sliceCount: 0, tagOptions: props.tagOptions }) - delete props.tagOptions delete props.allPages return { props, diff --git a/themes/example/LayoutCategoryIndex.js b/themes/example/LayoutCategoryIndex.js index 1230c20f..a4c19033 100644 --- a/themes/example/LayoutCategoryIndex.js +++ b/themes/example/LayoutCategoryIndex.js @@ -1,13 +1,12 @@ import Link from 'next/link' import LayoutBase from './LayoutBase' -export const LayoutCategoryIndex = (props) => { - const { categories } = props - +export const LayoutCategoryIndex = props => { + const { categoryOptions } = props return (
- {categories && categories.map(category => { + {categoryOptions?.map(category => { return ( { - const { tags } = props + const { tagOptions } = props return (
- {tags.map(tag => { + {tagOptions.map(tag => { return (
{
- ); + ) })}
- ); + ) } diff --git a/themes/example/components/SideBar.js b/themes/example/components/SideBar.js index 986063b0..742e661d 100644 --- a/themes/example/components/SideBar.js +++ b/themes/example/components/SideBar.js @@ -7,7 +7,7 @@ const ExampleRecentComments = dynamic(() => import('./ExampleRecentComments')) export const SideBar = (props) => { const { locale } = useGlobal() - const { latestPosts, categories } = props + const { latestPosts, categoryOptions } = props return (
@@ -16,7 +16,7 @@ export const SideBar = (props) => {
@@ -42,7 +42,7 @@ export const SideBar = (props) => {
  • {p.title}
  • - ); + ) })}
    @@ -61,5 +61,5 @@ export const SideBar = (props) => {
    - ); + ) } diff --git a/themes/hexo/LayoutCategoryIndex.js b/themes/hexo/LayoutCategoryIndex.js index 7d7165a6..fc03ded2 100644 --- a/themes/hexo/LayoutCategoryIndex.js +++ b/themes/hexo/LayoutCategoryIndex.js @@ -4,7 +4,7 @@ import Card from './components/Card' import LayoutBase from './LayoutBase' export const LayoutCategoryIndex = props => { - const { categories } = props + const { categoryOptions } = props const { locale } = useGlobal() return ( @@ -14,7 +14,7 @@ export const LayoutCategoryIndex = props => { {locale.COMMON.CATEGORY}:
    - {categories.map(category => { + {categoryOptions.map(category => { return ( { - const tag = props.tags.find((t) => { + const tag = props.tagOptions.find((t) => { return t.name === props.tag }) diff --git a/themes/hexo/LayoutTagIndex.js b/themes/hexo/LayoutTagIndex.js index 7649a704..b754e1e3 100644 --- a/themes/hexo/LayoutTagIndex.js +++ b/themes/hexo/LayoutTagIndex.js @@ -4,7 +4,7 @@ import TagItemMini from './components/TagItemMini' import LayoutBase from './LayoutBase' export const LayoutTagIndex = props => { - const { tags } = props + const { tagOptions } = props const { locale } = useGlobal() return ( @@ -14,7 +14,7 @@ export const LayoutTagIndex = props => { {locale.COMMON.TAGS}:
    - {tags.map(tag => { + {tagOptions.map(tag => { return (
    From be1bce6c2d7073f484fb9167b5a4b7871f56c2eb Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 3 Feb 2023 13:55:21 +0800 Subject: [PATCH 03/11] =?UTF-8?q?example=20=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/example/components/BlogListPage.js | 5 +++-- themes/example/components/SideBar.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/themes/example/components/BlogListPage.js b/themes/example/components/BlogListPage.js index 390bf90a..ce643eb8 100644 --- a/themes/example/components/BlogListPage.js +++ b/themes/example/components/BlogListPage.js @@ -15,6 +15,7 @@ export const BlogListPage = props => { const showNext = page < totalPage const pagePrefix = router.asPath.replace(/\/page\/[1-9]\d*/, '').replace(/\/$/, '') + console.log('p', posts) return (
    @@ -32,7 +33,7 @@ export const BlogListPage = props => {
    by {BLOG.AUTHOR} on {p.date?.start_date || p.createdTime} | - {p.category} + {p.category} {/* | */} {/* 2 Comments */}
    @@ -65,5 +66,5 @@ export const BlogListPage = props => {
    - ); + ) } diff --git a/themes/example/components/SideBar.js b/themes/example/components/SideBar.js index 742e661d..574bf230 100644 --- a/themes/example/components/SideBar.js +++ b/themes/example/components/SideBar.js @@ -23,7 +23,7 @@ export const SideBar = (props) => { href={`/category/${category.name}`} passHref legacyBehavior> -
  • {category.name}({category.count})
  • +
  • {category.name}({category.count})
  • ) })} @@ -40,7 +40,7 @@ export const SideBar = (props) => { {latestPosts?.map(p => { return ( -
  • {p.title}
  • +
  • {p.title}
  • ) })} From d5eb6f8940588812685965eaa7e2871b1821c8cd Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 3 Feb 2023 13:57:48 +0800 Subject: [PATCH 04/11] =?UTF-8?q?hexo=20tag\category=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/hexo/components/MenuGroupCard.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/hexo/components/MenuGroupCard.js b/themes/hexo/components/MenuGroupCard.js index 1641023a..a618c953 100644 --- a/themes/hexo/components/MenuGroupCard.js +++ b/themes/hexo/components/MenuGroupCard.js @@ -4,11 +4,11 @@ import { useGlobal } from '@/lib/global' import CONFIG_HEXO from '../config_hexo' const MenuGroupCard = (props) => { - const { postCount, categories, tags } = props + const { postCount, categoryOptions, tagOptions } = props const { locale } = useGlobal() const archiveSlot =
    {postCount}
    - const categorySlot =
    {categories?.length}
    - const tagSlot =
    {tags?.length}
    + const categorySlot =
    {categoryOptions?.length}
    + const tagSlot =
    {tagOptions?.length}
    const links = [ { name: locale.COMMON.ARTICLE, to: '/archive', slot: archiveSlot, show: CONFIG_HEXO.MENU_ARCHIVE }, @@ -34,12 +34,12 @@ const MenuGroupCard = (props) => {
    - ); + ) } else { return null } })} - ); + ) } export default MenuGroupCard From 80f46560218b57aa2cc30770f73b57b807d61ab1 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 3 Feb 2023 14:00:59 +0800 Subject: [PATCH 05/11] =?UTF-8?q?matery=E4=B8=BB=E9=A2=98=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=20tag/category?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/matery/LayoutCategory.js | 4 ++-- themes/matery/LayoutCategoryIndex.js | 4 ++-- themes/matery/LayoutTag.js | 4 ++-- themes/matery/LayoutTagIndex.js | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/themes/matery/LayoutCategory.js b/themes/matery/LayoutCategory.js index ab8a2b39..6e9524ab 100644 --- a/themes/matery/LayoutCategory.js +++ b/themes/matery/LayoutCategory.js @@ -6,7 +6,7 @@ import Link from 'next/link' import HeaderArticle from './components/HeaderArticle' export const LayoutCategory = props => { - const { category, categories } = props + const { category, categoryOptions } = props return ( } > @@ -15,7 +15,7 @@ export const LayoutCategory = props => {
    - {categories.map(e => { + {categoryOptions.map(e => { const selected = e.name === category return ( diff --git a/themes/matery/LayoutCategoryIndex.js b/themes/matery/LayoutCategoryIndex.js index fffc6ea5..31014270 100644 --- a/themes/matery/LayoutCategoryIndex.js +++ b/themes/matery/LayoutCategoryIndex.js @@ -3,7 +3,7 @@ import HeaderArticle from './components/HeaderArticle' import LayoutBase from './LayoutBase' export const LayoutCategoryIndex = props => { - const { categories } = props + const { categoryOptions } = props return ( } > @@ -13,7 +13,7 @@ export const LayoutCategoryIndex = props => {
    - {categories.map(e => { + {categoryOptions.map(e => { return (
    diff --git a/themes/matery/LayoutTag.js b/themes/matery/LayoutTag.js index 3f3d4fbd..3572d019 100644 --- a/themes/matery/LayoutTag.js +++ b/themes/matery/LayoutTag.js @@ -8,7 +8,7 @@ import { useGlobal } from '@/lib/global' import TagItemMiddle from './components/TagItemMiddle' export const LayoutTag = (props) => { - const { tags, tag } = props + const { tagOptions, tag } = props const { locale } = useGlobal() @@ -23,7 +23,7 @@ export const LayoutTag = (props) => {
    - {tags.map(e => { + {tagOptions.map(e => { const selected = tag === e.name return (
    diff --git a/themes/matery/LayoutTagIndex.js b/themes/matery/LayoutTagIndex.js index 7c196f7e..bfcb41b1 100644 --- a/themes/matery/LayoutTagIndex.js +++ b/themes/matery/LayoutTagIndex.js @@ -4,7 +4,7 @@ import TagItemMiddle from './components/TagItemMiddle' import LayoutBase from './LayoutBase' export const LayoutTagIndex = props => { - const { tags } = props + const { tagOptions } = props const { locale } = useGlobal() return ( } > @@ -17,7 +17,7 @@ export const LayoutTagIndex = props => {
    - {tags.map(tag => { + {tagOptions.map(tag => { return (
    From 94a0d0eabdadbfb1c458cd0b2d402d28f280415a Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 3 Feb 2023 14:03:36 +0800 Subject: [PATCH 06/11] next --- themes/next/LayoutCategory.js | 4 ++-- themes/next/LayoutCategoryIndex.js | 8 ++++---- themes/next/LayoutTag.js | 4 ++-- themes/next/LayoutTagIndex.js | 4 ++-- themes/next/components/CategoryList.js | 12 ++++++------ themes/next/components/TagList.js | 6 +++--- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/themes/next/LayoutCategory.js b/themes/next/LayoutCategory.js index 063918d4..ec71cb95 100644 --- a/themes/next/LayoutCategory.js +++ b/themes/next/LayoutCategory.js @@ -6,10 +6,10 @@ import BlogPostListPage from './components/BlogPostListPage' import BLOG from '@/blog.config' export const LayoutCategory = (props) => { - const { category, categories } = props + const { category, categoryOptions } = props return - +
    {BLOG.POST_LIST_STYLE !== 'page' diff --git a/themes/next/LayoutCategoryIndex.js b/themes/next/LayoutCategoryIndex.js index 9089fff8..0dd99e0f 100644 --- a/themes/next/LayoutCategoryIndex.js +++ b/themes/next/LayoutCategoryIndex.js @@ -3,7 +3,7 @@ import LayoutBase from './LayoutBase' import Link from 'next/link' export const LayoutCategoryIndex = (props) => { - const { allPosts, categories } = props + const { allPosts, categoryOptions } = props const { locale } = useGlobal() return ( @@ -12,7 +12,7 @@ export const LayoutCategoryIndex = (props) => { {locale.COMMON.CATEGORY}:
    - {categories.map(category => { + {categoryOptions.map(category => { return ( { {category.name}({category.count})
    - ); + ) })}
    - ); + ) } diff --git a/themes/next/LayoutTag.js b/themes/next/LayoutTag.js index fdb47239..c70307e8 100644 --- a/themes/next/LayoutTag.js +++ b/themes/next/LayoutTag.js @@ -6,11 +6,11 @@ import BlogPostListPage from './components/BlogPostListPage' import BLOG from '@/blog.config' export const LayoutTag = (props) => { - const { tags, tag } = props + const { tagOptions, tag } = props return - +
    {BLOG.POST_LIST_STYLE !== 'page' diff --git a/themes/next/LayoutTagIndex.js b/themes/next/LayoutTagIndex.js index 45100a9e..5278dd8f 100644 --- a/themes/next/LayoutTagIndex.js +++ b/themes/next/LayoutTagIndex.js @@ -3,13 +3,13 @@ import LayoutBase from './LayoutBase' import TagItem from './components/TagItem' export const LayoutTagIndex = (props) => { - const { tags } = props + const { tagOptions } = props const { locale } = useGlobal() return
    {locale.COMMON.TAGS}:
    - { tags.map(tag => { + { tagOptions.map(tag => { return
    }) }
    diff --git a/themes/next/components/CategoryList.js b/themes/next/components/CategoryList.js index 2d384479..ffe038ef 100644 --- a/themes/next/components/CategoryList.js +++ b/themes/next/components/CategoryList.js @@ -2,16 +2,16 @@ import Link from 'next/link' import React from 'react' import { useGlobal } from '@/lib/global' -const CategoryList = ({ currentCategory, categories }) => { - if (!categories) { +const CategoryList = ({ currentCategory, categoryOptions }) => { + const { locale } = useGlobal() + if (!categoryOptions) { return <> } - const { locale } = useGlobal() return (
    • {locale.COMMON.CATEGORY}
    • - {categories.map(category => { + {categoryOptions.map(category => { const selected = category.name === currentCategory return ( { - ); + ) })}
    - ); + ) } export default CategoryList diff --git a/themes/next/components/TagList.js b/themes/next/components/TagList.js index f5b7d030..973e7b68 100644 --- a/themes/next/components/TagList.js +++ b/themes/next/components/TagList.js @@ -7,13 +7,13 @@ import TagItem from './TagItem' * @returns {JSX.Element} * @constructor */ -const TagList = ({ tags, currentTag }) => { - if (!tags) { +const TagList = ({ tagOptions, currentTag }) => { + if (!tagOptions) { return <> } return
    • 标签:
    • - {tags.map(tag => { + {tagOptions.map(tag => { const selected = tag.name === currentTag return })} From 42d382f90007202540f3294dc5b826721d64023c Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 3 Feb 2023 14:05:45 +0800 Subject: [PATCH 07/11] medium tag/category --- themes/medium/LayoutCategoryIndex.js | 4 ++-- themes/medium/LayoutTagIndex.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/medium/LayoutCategoryIndex.js b/themes/medium/LayoutCategoryIndex.js index 5d200fe2..c9c79254 100644 --- a/themes/medium/LayoutCategoryIndex.js +++ b/themes/medium/LayoutCategoryIndex.js @@ -3,7 +3,7 @@ import Link from 'next/link' import LayoutBase from './LayoutBase' export const LayoutCategoryIndex = (props) => { - const { categories } = props + const { categoryOptions } = props const { locale } = useGlobal() return ( @@ -12,7 +12,7 @@ export const LayoutCategoryIndex = (props) => { {locale.COMMON.CATEGORY}:
    - {categories && categories.map(category => { + {categoryOptions?.map(category => { return ( { - const { tags } = props + const { tagOptions } = props const { locale } = useGlobal() return ( @@ -13,7 +13,7 @@ export const LayoutTagIndex = props => { {locale.COMMON.TAGS}:
    - {tags.map(tag => { + {tagOptions.map(tag => { return (
    From 833918f6a8a73a0cc1494f8a05bc007e25e1a162 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 3 Feb 2023 14:07:39 +0800 Subject: [PATCH 08/11] fukasawa --- themes/fukasawa/LayoutCategoryIndex.js | 4 ++-- themes/fukasawa/LayoutTagIndex.js | 4 ++-- themes/fukasawa/components/AsideLeft.js | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/themes/fukasawa/LayoutCategoryIndex.js b/themes/fukasawa/LayoutCategoryIndex.js index e44e86dc..9e9cdd9c 100644 --- a/themes/fukasawa/LayoutCategoryIndex.js +++ b/themes/fukasawa/LayoutCategoryIndex.js @@ -4,7 +4,7 @@ import LayoutBase from './LayoutBase' export const LayoutCategoryIndex = (props) => { const { locale } = useGlobal() - const { categories } = props + const { categoryOptions } = props return (
    @@ -12,7 +12,7 @@ export const LayoutCategoryIndex = (props) => { {locale.COMMON.CATEGORY}:
    - {categories && categories.map(category => { + {categoryOptions?.map(category => { return ( { const { locale } = useGlobal() - const { tags } = props + const { tagOptions } = props return
    {locale.COMMON.TAGS}:
    - { tags.map(tag => { + { tagOptions.map(tag => { return
    }) }
    diff --git a/themes/fukasawa/components/AsideLeft.js b/themes/fukasawa/components/AsideLeft.js index 9b438bd4..adec77fa 100644 --- a/themes/fukasawa/components/AsideLeft.js +++ b/themes/fukasawa/components/AsideLeft.js @@ -9,9 +9,9 @@ import { useRouter } from 'next/router' import DarkModeButton from '@/components/DarkModeButton' function AsideLeft (props) { - const { tags, currentTag, categories, currentCategory, post, slot, siteInfo } = props + const { tagOptions, currentTag, categoryOptions, currentCategory, post, slot, siteInfo } = props const router = useRouter() - return
    + return
    @@ -31,12 +31,12 @@ function AsideLeft (props) { {router.asPath !== '/tag' &&

    - +
    } {router.asPath !== '/category' &&

    - +
    }
    From 8621d0b0e4e8951a1852333e8c5691c6d28c204d Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 3 Feb 2023 14:22:38 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=BD=A9=E5=B8=A6?= =?UTF-8?q?=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/FlutteringRibbon.js | 1 + 1 file changed, 1 insertion(+) diff --git a/components/FlutteringRibbon.js b/components/FlutteringRibbon.js index 2eb817e4..a615d533 100644 --- a/components/FlutteringRibbon.js +++ b/components/FlutteringRibbon.js @@ -136,6 +136,7 @@ function createFlutteringRibbon() { (this._canvas.style.width = '100%'), (this._canvas.style.height = '100%'), (this._canvas.style['z-index'] = '0'), + (this._canvas.style['pointer-events'] = 'none'), this._onResize(), (this._context = this._canvas.getContext('2d')), this._context.clearRect(0, 0, this._width, this._height), From 9497e9fb0ac69e453448b69ec93cfb70f832cb70 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 3 Feb 2023 14:24:16 +0800 Subject: [PATCH 10/11] nobelium tag/category --- themes/nobelium/LayoutBase.js | 2 +- themes/nobelium/LayoutCategoryIndex.js | 8 ++++---- themes/nobelium/LayoutTagIndex.js | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/themes/nobelium/LayoutBase.js b/themes/nobelium/LayoutBase.js index 7e6ec817..598a9b9b 100644 --- a/themes/nobelium/LayoutBase.js +++ b/themes/nobelium/LayoutBase.js @@ -16,7 +16,7 @@ const LayoutBase = props => { const fullWidth = post?.fullWidth ?? false return ( -
    +
    {/* 顶部导航栏 */} diff --git a/themes/nobelium/LayoutCategoryIndex.js b/themes/nobelium/LayoutCategoryIndex.js index 6d1884ab..3cf9c10d 100644 --- a/themes/nobelium/LayoutCategoryIndex.js +++ b/themes/nobelium/LayoutCategoryIndex.js @@ -2,12 +2,12 @@ import Link from 'next/link' import LayoutBase from './LayoutBase' export const LayoutCategoryIndex = (props) => { - const { categories } = props + const { categoryOptions } = props return (
    - {categories && categories.map(category => { + {categoryOptions?.map(category => { return ( { {category.name}({category.count})
    - ); + ) })}
    - ); + ) } diff --git a/themes/nobelium/LayoutTagIndex.js b/themes/nobelium/LayoutTagIndex.js index 6d2873a8..0705c2d6 100644 --- a/themes/nobelium/LayoutTagIndex.js +++ b/themes/nobelium/LayoutTagIndex.js @@ -2,12 +2,12 @@ import Link from 'next/link' import LayoutBase from './LayoutBase' export const LayoutTagIndex = (props) => { - const { tags } = props + const { tagOptions } = props return (
    - {tags.map(tag => { + {tagOptions.map(tag => { return (
    {
    - ); + ) })}
    - ); + ) } From 6e638a545bfa2858337f510a4b609542ce011df7 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 3 Feb 2023 14:30:57 +0800 Subject: [PATCH 11/11] 3.9.2 --- .env.local | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.local b/.env.local index 5f3e2582..4b00e7e6 100644 --- a/.env.local +++ b/.env.local @@ -1,2 +1,2 @@ # 环境变量 @see https://www.nextjs.cn/docs/basic-features/environment-variables -NEXT_PUBLIC_VERSION=3.9.1 +NEXT_PUBLIC_VERSION=3.9.2 diff --git a/package.json b/package.json index 456eadf4..b23b67f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notion-next", - "version": "3.9.1", + "version": "3.9.2", "homepage": "https://github.com/tangly1024/NotionNext.git", "license": "MIT", "repository": {