.*?<\/div><\/div>
.*?<\/div><\/div><\/div><\/div>/g
return content.replace(regexExp, '')
}
- return post.summary
}
export async function generateRss(posts) {
diff --git a/lib/utils.js b/lib/utils.js
index be47e17f..be9db197 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -64,10 +64,19 @@ export function mergeDeep(target, ...sources) {
}
/**
- * 对象检查
+ * 是否对象
* @param item
* @returns {boolean}
*/
export function isObject(item) {
return (item && typeof item === 'object' && !Array.isArray(item))
}
+
+/**
+ * 是否可迭代
+ * @param {*} obj
+ * @returns
+ */
+export function isIterable(obj) {
+ return obj != null && typeof obj[Symbol.iterator] === 'function'
+}
diff --git a/package.json b/package.json
index d47bdc78..9b48294c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "notion-next",
- "version": "3.1.0",
+ "version": "3.2.1",
"homepage": "https://github.com/tangly1024/NotionNext.git",
"license": "MIT",
"repository": {
@@ -40,8 +40,10 @@
"react-cookies": "^0.1.1",
"react-cusdis": "^2.1.3",
"react-dom": "17.0.2",
+ "react-facebook": "^8.1.4",
"react-messenger-customer-chat": "^0.8.0",
"react-notion-x": "6.6.2",
+ "react-share": "^4.4.0",
"smoothscroll-polyfill": "^0.4.4",
"typed.js": "^2.0.12",
"use-ackee": "^3.0.0"
diff --git a/pages/article/[slug].js b/pages/article/[slug].js
index b190738d..538cbc90 100644
--- a/pages/article/[slug].js
+++ b/pages/article/[slug].js
@@ -5,6 +5,7 @@ import { useGlobal } from '@/lib/global'
import * as ThemeMap from '@/themes'
import { useEffect, useState } from 'react'
import { useRouter } from 'next/router'
+import { idToUuid } from 'notion-utils'
/**
* 根据notion的slug访问页面
@@ -30,7 +31,7 @@ const Slug = props => {
}
}, 3000)
})
- const meta = { title: `${props?.siteInfo?.title} | loading` }
+ const meta = { title: `${props?.siteInfo?.title || BLOG.TITLE} | loading` }
return
}
@@ -92,7 +93,9 @@ export async function getStaticProps({ params: { slug } }) {
const from = `slug-props-${slug}`
const props = await getGlobalNotionData({ from, pageType: ['Post'] })
const allPosts = props.allPosts
- props.post = props.allPosts.find(p => p.slug === slug)
+ props.post = props.allPosts.find((p) => {
+ return p.slug === slug || p.id === idToUuid(slug)
+ })
if (!props.post) {
return { props, revalidate: 1 }
}
diff --git a/styles/notion.css b/styles/notion.css
index d42d3b11..b176aed2 100644
--- a/styles/notion.css
+++ b/styles/notion.css
@@ -1601,7 +1601,7 @@ svg.notion-page-icon {
}
svg.notion-page-icon {
- @apply hidden;
+ /* @apply hidden;*/
}
svg + .notion-page-title-text {
diff --git a/themes/example/LayoutSearch.js b/themes/example/LayoutSearch.js
index d24024a5..110c11a6 100644
--- a/themes/example/LayoutSearch.js
+++ b/themes/example/LayoutSearch.js
@@ -38,7 +38,7 @@ export const LayoutSearch = props => {
Search - {keyword}
- {postsToShow.map(p => (
+ {postsToShow?.map(p => (
{p.title}
diff --git a/themes/fukasawa/LayoutIndex.js b/themes/fukasawa/LayoutIndex.js
index 0158a856..7559d65b 100644
--- a/themes/fukasawa/LayoutIndex.js
+++ b/themes/fukasawa/LayoutIndex.js
@@ -3,6 +3,6 @@ import LayoutBase from './LayoutBase'
export const LayoutIndex = (props) => {
return
-
+
}
diff --git a/themes/fukasawa/LayoutSearch.js b/themes/fukasawa/LayoutSearch.js
index 727e9595..46d01031 100644
--- a/themes/fukasawa/LayoutSearch.js
+++ b/themes/fukasawa/LayoutSearch.js
@@ -14,10 +14,9 @@ export const LayoutSearch = (props) => {
const re = new RegExp(`${currentSearch}`, 'gim')
container.innerHTML = container.innerHTML.replace(re, `
${currentSearch}`)
}
- },
- 100)
+ }, 100)
})
return
-
+
}
diff --git a/themes/fukasawa/components/BlogCard.js b/themes/fukasawa/components/BlogCard.js
index 507bac40..f7235c71 100644
--- a/themes/fukasawa/components/BlogCard.js
+++ b/themes/fukasawa/components/BlogCard.js
@@ -7,7 +7,7 @@ import Card from './Card'
const BlogCard = ({ post, showSummary }) => {
const showPreview = CONFIG_FUKA.POST_LIST_PREVIEW && post.blockMap
return (
-
+
{
{post.title}
diff --git a/themes/fukasawa/components/BlogListPage.js b/themes/fukasawa/components/BlogListPage.js
index 51c1c6c1..a418ff47 100644
--- a/themes/fukasawa/components/BlogListPage.js
+++ b/themes/fukasawa/components/BlogListPage.js
@@ -17,7 +17,7 @@ const BlogListPage = ({ page = 1, posts = [], postCount }) => {
const showNext = page < totalPage && posts.length === BLOG.POSTS_PER_PAGE && posts.length < postCount
const [colCount, changeCol] = useState(1)
- function updateCol () {
+ function updateCol() {
if (window.outerWidth > 1200) {
changeCol(3)
} else {
@@ -40,7 +40,7 @@ const BlogListPage = ({ page = 1, posts = [], postCount }) => {
{/* 文章列表 */}
- {posts.map(post => (
+ {posts?.map(post => (
diff --git a/themes/fukasawa/components/Catalog.js b/themes/fukasawa/components/Catalog.js
index 2e67c392..cad8ce68 100644
--- a/themes/fukasawa/components/Catalog.js
+++ b/themes/fukasawa/components/Catalog.js
@@ -58,7 +58,7 @@ const Catalog = ({ toc }) => {
return
目录
-
+