From bcb8620d31ab403d600381b2c20e52d2609e989e Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 24 Apr 2023 17:49:04 +0800 Subject: [PATCH 01/40] =?UTF-8?q?Page=20=E4=B8=BA=E7=A9=BA=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getNotionData.js | 39 ++++++++++++++++------ themes/hexo/components/BlogPostCardInfo.js | 2 +- themes/next/components/BlogPostCard.js | 2 +- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index 0e2d5bcb..55c15678 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -68,7 +68,7 @@ export async function getNotionPageData({ pageId, from }) { console.log('[命中缓存]:', `from:${from}`, `root-page-id:${pageId}`) return data } - const pageRecordMap = await getPageRecordMapByNotionAPI({ pageId, from }) + const pageRecordMap = await getDataBaseInfoByNotionAPI({ pageId, from }) // 存入缓存 if (pageRecordMap) { await setDataToCache(cacheKey, pageRecordMap) @@ -177,24 +177,44 @@ async function getNotice(post) { * 调用NotionAPI获取Page数据 * @returns {Promise} */ -async function getPageRecordMapByNotionAPI({ pageId, from }) { +async function getDataBaseInfoByNotionAPI({ pageId, from }) { const pageRecordMap = await getPostBlocks(pageId, from) if (!pageRecordMap) { - return [] + console.error('can`t get Notion Data ; Which id is: ', pageId) + return {} } pageId = idToUuid(pageId) - const block = pageRecordMap.block + const block = pageRecordMap.block || {} const rawMetadata = block[pageId]?.value // Check Type Page-Database和Inline-Database if ( - rawMetadata?.type !== 'collection_view_page' && - rawMetadata?.type !== 'collection_view' + rawMetadata?.type !== 'collection_view_page' && rawMetadata?.type !== 'collection_view' ) { - console.warn(`pageId "${pageId}" is not a database`) - return null + console.error(`pageId "${pageId}" is not a database`) + return { + notice: null, + siteInfo: getBlogInfo({}), + allPages: [{ id: 1, title: `无法获取Notion数据,请检查Notion_ID: \n 当前 ${pageId}`, summary: '访问文档获取帮助→ https://tangly1024.com/article/vercel-deploy-notion-next', status: 'Published', type: 'Post', slug: '13a171332816461db29d50e9f575b00d', date: { start_date: '2023-04-24', lastEditedTime: '2023-04-24', tagItems: [] } }], + collection: [], + collectionQuery: {}, + collectionId: null, + collectionView: {}, + viewIds: [], + block: {}, + schema: {}, + tagOptions: [], + categoryOptions: [], + rawMetadata: {}, + customNav: [], + customMenu: [], + postCount: 1, + pageIds: [], + latestPosts: [] + } } - const collection = Object.values(pageRecordMap.collection)[0]?.value + const collection = Object.values(pageRecordMap.collection)[0]?.value || {} + const siteInfo = getBlogInfo({ collection, block }) const collectionId = rawMetadata?.collection_id const collectionQuery = pageRecordMap.collection_query const collectionView = pageRecordMap.collection_view @@ -242,7 +262,6 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) { const notice = await getNotice(collectionData.filter(post => { return post && post?.type && post?.type === 'Notice' && post.status === 'Published' })?.[0]) const categoryOptions = getAllCategories({ allPages, categoryOptions: getCategoryOptions(schema) }) const tagOptions = getAllTags({ allPages, tagOptions: getTagOptions(schema) }) - const siteInfo = getBlogInfo({ collection, block }) const customNav = getCustomNav({ allPages: collectionData.filter(post => post.type === 'Page' && post.status === 'Published') }) // 新的菜单 const customMenu = await getCustomMenu({ collectionData }) diff --git a/themes/hexo/components/BlogPostCardInfo.js b/themes/hexo/components/BlogPostCardInfo.js index 88ceaeed..7336b64a 100644 --- a/themes/hexo/components/BlogPostCardInfo.js +++ b/themes/hexo/components/BlogPostCardInfo.js @@ -78,7 +78,7 @@ export const BlogPostCardInfo = ({ post, showPreview, showPageCover, showSummary
{' '} - {post.tagItems.map(tag => ( + {post.tagItems?.map(tag => ( ))}
diff --git a/themes/next/components/BlogPostCard.js b/themes/next/components/BlogPostCard.js index ad45b4a3..c10545a3 100644 --- a/themes/next/components/BlogPostCard.js +++ b/themes/next/components/BlogPostCard.js @@ -60,7 +60,7 @@ const BlogPostCard = ({ post, showSummary }) => {
{' '} - {post.tagItems.map(tag => ( + {post.tagItems?.map(tag => ( ))}
From b6c1c9d3ad250030ee55ec7e75032af7f4572d45 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Mon, 24 Apr 2023 17:49:45 +0800 Subject: [PATCH 02/40] =?UTF-8?q?=E5=AD=97=E4=BD=93=E5=BA=93fontawesome?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blog.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blog.config.js b/blog.config.js index 4d53eaff..1b6755f8 100644 --- a/blog.config.js +++ b/blog.config.js @@ -66,7 +66,7 @@ const BLOG = { '"Segoe UI Symbol"', '"Apple Color Emoji"' ], - FONT_AWESOME: '/css/all.min.css', // font-awesome 字体图标地址 + FONT_AWESOME: '/css/all.min.css', // font-awesome 字体图标地址、默认读取本地; 可选 https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/font-awesome/6.0.0/css/all.min.css // 自定义外部脚本,外部样式 CUSTOM_EXTERNAL_JS: [''], // e.g. ['http://xx.com/script.js','http://xx.com/script.js'] From 2db4816eeae969fd1149ee99586a44b1d1024055 Mon Sep 17 00:00:00 2001 From: RedhairHambagu <129669334+RedhairHambagu@users.noreply.github.com> Date: Mon, 24 Apr 2023 21:35:27 +0800 Subject: [PATCH 03/40] fix only display toc of current page --- pages/[...slug].js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/[...slug].js b/pages/[...slug].js index 8ed9f270..d51ef3ef 100644 --- a/pages/[...slug].js +++ b/pages/[...slug].js @@ -31,7 +31,7 @@ const Slug = props => { setLock(true) } else { if (!lock && post?.blockMap?.block) { - post.content = Object.keys(post.blockMap.block) + post.content = Object.keys(post.blockMap.block).filter(key => post.blockMap.block[key]?.value.parent_id === post.id) post.toc = getPageTableOfContents(post, post.blockMap) } From 490497f9ac7719dd64b52806854582d1bcca5c14 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Apr 2023 11:50:17 +0800 Subject: [PATCH 04/40] =?UTF-8?q?fix=20=20hexo\matery=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E5=88=97=E8=A1=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/notion/getNotionData.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index 55c15678..e723a83d 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -242,7 +242,7 @@ async function getDataBaseInfoByNotionAPI({ pageId, from }) { let postCount = 0 // 查找所有的Post和Page const allPages = collectionData.filter(post => { - if (post.type === BLOG.NOTION_PROPERTY_NAME.type_post && post.status === BLOG.NOTION_PROPERTY_NAME.status_publish) { + if (post.type === 'Post' && post.status === 'Published') { postCount++ } return post && post?.slug && From 889de065dcfabda8b2388af6f7cc53764c658905 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Apr 2023 12:05:16 +0800 Subject: [PATCH 05/40] new contributor --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 63de7af3..0b2ac090 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,11 @@ Hongzzz
Hongzzz

🔧 🐛 + + + RedhairHambagu
RedhairHambagu

🔧 🐛 + + From 6130ff234656ff031e0c3c936cb7bfd3079e598d Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Apr 2023 12:40:01 +0800 Subject: [PATCH 06/40] readme en --- README.md | 5 ++ README_EN.md | 184 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 189 insertions(+) create mode 100644 README_EN.md diff --git a/README.md b/README.md index 63de7af3..1f60c1df 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,11 @@

+ +中文README | [README in English](./README_EN.md) + +
+ 一个使用 NextJS + Notion API 实现的,部署在 Vercel 上的静态博客系统。为Notion和所有创作者设计。 diff --git a/README_EN.md b/README_EN.md new file mode 100644 index 00000000..82d5bc97 --- /dev/null +++ b/README_EN.md @@ -0,0 +1,184 @@ +# NotionNext + +

+ + + + + + + + + + + + +

+ + +[中文README](./README.md) | README in English + +
+ +A static blog system built with NextJS and Notion API, deployed on Vercel. Designed for Notion and all creators. + + +## Preview + +Live Demo:[https://preview.tangly1024.com/](https://preview.tangly1024.com/) ,Project supports switching between multiple themes. Can't find a theme you like? How about [contributing](/CONTRIBUTING.md) one?~ + +| Next | Medium | Hexo | Fukasawa | +|--|--|--|--| +| [NEXT](https://preview.tangly1024.com/?theme=next) | [MEDIUM](https://preview.tangly1024.com/?theme=medium) | [HEXO](https://preview.tangly1024.com/?theme=hexo) | [FUKASAWA](https://preview.tangly1024.com/?theme=fukasawa) | + +## Get Start! + +It only takes a few minutes to set up your personal site: + +- [快速部署教程 - 多种方案可供选择](https://tangly1024.com/article/notion-next) + +- [个性配置手册 - 如何配置功能插件](https://tangly1024.com/article/notion-next-guide) + +- [二次开发指引 - 如何进行本地开发](https://tangly1024.com/article/how-to-develop-with-notion-next) + + +## Acknowledgements + +Special thanks to Craig Hart for initiating the Nobelium project. + + + +
Craig Hart
Craig Hart
+ +## Contributors + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ tangly1024
tangly1024

🎫 🔧 🐛 +
+ uWayLu
uWayLu

🔧 🐛 +
+ txs
txs

🔧 🐛 +
+ yuzhanglong
yuzhanglong

🔧 🐛 +
+ Hscpro
Hscpro

🔧 🐛 +
+ JensonMiao
JensonMiao

🔧 🐛 +
+ haixin1225
haixin1225

🔧 🐛 +
+ mouyase
mouyase

🔧 🐛 +
+ qfdk
qfdk

🔧 🐛 +
+ ifyz
ifyz

🔧 🐛 +
+ Liqun Zhao
Liqun Zhao

🔧 🐛 +
+ Ylarod
Ylarod

🔧 🐛 +
+ Etherrreal.
Etherrreal.

🔧 🐛 +
+ Joshua Astray
Joshua Astray

🔧 🐛 +
+ Vixcity
Vixcity

🔧 🐛 +
+ ipatpat
ipatpat

🔧 🐛 +
+ xloong
xloong

🔧 🐛 +
+ expoli
expoli

🔧 🐛 +
+ SuperHuangXu
bUBBLE

🔧 🐛 +
+ Pylogmon
派了个萌

🔧 🐛 +
+ SkysCrystal
Simon Shi

🔧 🐛 +
+ S.Y. Lee
S.Y. Lee

🔧 🐛 +
+ fighting-buf
fighting-buf

🔧 🐛 +
+ cliouo
cliouo

🔧 🐛 +
+ Sude Akgün
Sude Akgün

🔧 🐛 +
+ Ray
Ray

🔧 🐛 +
+ Hongzzz
Hongzzz

🔧 🐛 +
+ RedhairHambagu
RedhairHambagu

🔧 🐛 +
+ + +## Technologies Used + +- **Technical Framework**: [Next.js](https://nextjs.org) +- **Styles**: [Tailwind CSS](https://www.tailwindcss.cn/) +- **Rendering Tool**: [React-notion-x](https://github.com/NotionX/react-notion-x) +- **COMMENT**: [Twikoo](https://github.com/imaegoo/twikoo), [Giscus](https://giscus.app/zh-CN), [Gitalk](https://gitalk.github.io), [Cusdis](https://cusdis.com), [Utterances](https://utteranc.es) +- **ICON**: [Fontawesome](https://fontawesome.com/v6/icons/) + + +## License + +The MIT License. From 27f45c90666389b26d25e82b752b1119be071f4a Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Apr 2023 12:42:14 +0800 Subject: [PATCH 07/40] readme --- README.md | 2 +- README_EN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4473e6b0..2fefab40 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@

-中文README | [README in English](./README_EN.md) +中文文档 | [README in English](./README_EN.md)
diff --git a/README_EN.md b/README_EN.md index 82d5bc97..b2a9f85c 100644 --- a/README_EN.md +++ b/README_EN.md @@ -16,7 +16,7 @@

-[中文README](./README.md) | README in English +[中文文档](./README.md) | README in English
From c1bf6a432158e6e20b5e95ae7690ed8cf9b48b67 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Apr 2023 14:20:09 +0800 Subject: [PATCH 08/40] =?UTF-8?q?=E5=88=86=E4=BA=AB=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=89=80=E6=9C=89=E4=B8=BB=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blog.config.js | 2 ++ .../components => components}/ShareBar.js | 23 +++++++++---------- .../components => components}/ShareButton.js | 0 lib/notion/getNotionData.js | 2 +- lib/notion/getPostBlocks.js | 2 +- themes/example/LayoutSlug.js | 3 ++- themes/fukasawa/components/ArticleDetail.js | 6 +++++ themes/hexo/LayoutSlug.js | 4 ++++ themes/matery/LayoutSlug.js | 4 +++- themes/medium/LayoutSlug.js | 3 +++ themes/next/components/ArticleDetail.js | 6 +++-- themes/next/config_next.js | 1 - themes/nobelium/LayoutSlug.js | 2 ++ themes/simple/LayoutSlug.js | 3 +++ 14 files changed, 42 insertions(+), 19 deletions(-) rename {themes/next/components => components}/ShareBar.js (86%) rename {themes/next/components => components}/ShareButton.js (100%) diff --git a/blog.config.js b/blog.config.js index 1b6755f8..1b01e9dc 100644 --- a/blog.config.js +++ b/blog.config.js @@ -96,6 +96,8 @@ const BLOG = { BACKGROUND_DARK: '#000000', // use hex value, don't forget '#' SUB_PATH: '', // leave this empty unless you want to deploy in a folder + POST_SHARE_BAR_ENABLE: process.env.NEXT_PUBLIC_POST_SHARE_BAR || 'false', // 文章分享功能 ,将在底部显示一个分享条 + POST_URL_PREFIX: process.env.NEXT_PUBLIC_POST_URL_PREFIX || 'article', // POST类型文章的默认路径前缀,例如默认POST类型的路径是 /article/[slug] // 如果此项配置为 '' 空, 则文章将没有前缀路径,使用场景: 希望文章前缀路径为 /post 的情况 支持多级 diff --git a/themes/next/components/ShareBar.js b/components/ShareBar.js similarity index 86% rename from themes/next/components/ShareBar.js rename to components/ShareBar.js index c595da13..97f46395 100644 --- a/themes/next/components/ShareBar.js +++ b/components/ShareBar.js @@ -5,15 +5,16 @@ import { createPopper } from '@popperjs/core' import copy from 'copy-to-clipboard' import QRCode from 'qrcode.react' import { useGlobal } from '@/lib/global' -import CONFIG_NEXT from '../config_next' const ShareBar = ({ post }) => { const router = useRouter() const [qrCodeShow, setQrCodeShow] = React.useState(false) const { locale } = useGlobal() - if (!CONFIG_NEXT.ARTICLE_SHARE) { + + if (!JSON.parse(BLOG.POST_SHARE_BAR_ENABLE) || !post || post?.type !== 'Post') { return <> } + const shareUrl = BLOG.LINK + router.asPath // 二维码悬浮 @@ -35,26 +36,25 @@ const ShareBar = ({ post }) => { alert(locale.COMMON.URL_COPIED) } - return <> -
{locale.COMMON.SHARE}:
-
+ -
+ -
+ -
+ -
+ -
+ -
+
- } export default ShareBar diff --git a/themes/next/components/ShareButton.js b/components/ShareButton.js similarity index 100% rename from themes/next/components/ShareButton.js rename to components/ShareButton.js diff --git a/lib/notion/getNotionData.js b/lib/notion/getNotionData.js index e723a83d..9b586e65 100644 --- a/lib/notion/getNotionData.js +++ b/lib/notion/getNotionData.js @@ -65,7 +65,7 @@ export async function getNotionPageData({ pageId, from }) { const cacheKey = 'page_block_' + pageId const data = await getDataFromCache(cacheKey) if (data && data.pageIds?.length > 0) { - console.log('[命中缓存]:', `from:${from}`, `root-page-id:${pageId}`) + console.log('[缓存]:', `from:${from}`, `root-page-id:${pageId}`) return data } const pageRecordMap = await getDataBaseInfoByNotionAPI({ pageId, from }) diff --git a/lib/notion/getPostBlocks.js b/lib/notion/getPostBlocks.js index 5fe2af84..8e764f7b 100644 --- a/lib/notion/getPostBlocks.js +++ b/lib/notion/getPostBlocks.js @@ -14,7 +14,7 @@ export async function getPostBlocks(id, from, slice) { const cacheKey = 'page_block_' + id let pageBlock = await getDataFromCache(cacheKey) if (pageBlock) { - console.log('[命中缓存]:', `from:${from}`, cacheKey) + console.log('[缓存]:', `from:${from}`, cacheKey) return filterPostBlocks(id, pageBlock, slice) } diff --git a/themes/example/LayoutSlug.js b/themes/example/LayoutSlug.js index b16892b7..b19f51ff 100644 --- a/themes/example/LayoutSlug.js +++ b/themes/example/LayoutSlug.js @@ -3,6 +3,7 @@ import { ArticleLock } from './components/ArticleLock' import NotionPage from '@/components/NotionPage' import { ArticleInfo } from './components/ArticleInfo' import Comment from '@/components/Comment' +import ShareBar from '@/components/ShareBar' export const LayoutSlug = props => { const { post, lock, validPassword } = props @@ -17,10 +18,10 @@ export const LayoutSlug = props => { {lock && } {!lock &&
- {post && <> + }
} diff --git a/themes/fukasawa/components/ArticleDetail.js b/themes/fukasawa/components/ArticleDetail.js index 65af8400..e9e82b0f 100644 --- a/themes/fukasawa/components/ArticleDetail.js +++ b/themes/fukasawa/components/ArticleDetail.js @@ -1,5 +1,6 @@ import Comment from '@/components/Comment' import NotionPage from '@/components/NotionPage' +import ShareBar from '@/components/ShareBar' import formatDate from '@/lib/formatDate' import { useGlobal } from '@/lib/global' import Link from 'next/link' @@ -84,6 +85,11 @@ export default function ArticleDetail(props) { {post && } +
+ {/* 分享 */} + +
+
{/* 文章内嵌广告 */} { const { post, lock, validPassword } = props @@ -76,6 +77,9 @@ export const LayoutSlug = props => {
+ {/* 分享 */} + + {/* 评论互动 */}
diff --git a/themes/matery/LayoutSlug.js b/themes/matery/LayoutSlug.js index 12fefce4..e938942b 100644 --- a/themes/matery/LayoutSlug.js +++ b/themes/matery/LayoutSlug.js @@ -10,6 +10,7 @@ import { ArticleInfo } from './components/ArticleInfo' import Catalog from './components/Catalog' import JumpToCommentButton from './components/JumpToCommentButton' import throttle from 'lodash.throttle' +import ShareBar from '@/components/ShareBar' export const LayoutSlug = props => { const { post, lock, validPassword } = props @@ -87,7 +88,8 @@ export const LayoutSlug = props => {
- + {/* 分享 */} + {/* 评论互动 */}
diff --git a/themes/medium/LayoutSlug.js b/themes/medium/LayoutSlug.js index 6000c3f3..b6d54077 100644 --- a/themes/medium/LayoutSlug.js +++ b/themes/medium/LayoutSlug.js @@ -13,6 +13,7 @@ import ArticleAround from './components/ArticleAround' import TocDrawer from './components/TocDrawer' import CategoryItem from './components/CategoryItem' import TagItemMini from './components/TagItemMini' +import ShareBar from '@/components/ShareBar' export const LayoutSlug = props => { const { post, prev, next, siteInfo, lock, validPassword } = props @@ -92,6 +93,8 @@ export const LayoutSlug = props => {
{post.type === 'Post' && } + {/* 分享 */} +
diff --git a/themes/next/components/ArticleDetail.js b/themes/next/components/ArticleDetail.js index e5b8dba2..75fc7f7d 100644 --- a/themes/next/components/ArticleDetail.js +++ b/themes/next/components/ArticleDetail.js @@ -2,7 +2,7 @@ import BLOG from '@/blog.config' import BlogAround from './BlogAround' import Comment from '@/components/Comment' import RecommendPosts from './RecommendPosts' -import ShareBar from './ShareBar' +import ShareBar from '@/components/ShareBar' import TagItem from './TagItem' import formatDate from '@/lib/formatDate' import { useGlobal } from '@/lib/global' @@ -100,6 +100,9 @@ export default function ArticleDetail(props) { {/* 推荐文章 */} {post.type === 'Post' && } + {/* 分享 */} + +
{/* 分类 */} {post.category && <> @@ -124,7 +127,6 @@ export default function ArticleDetail(props) { ))}
)} - )} diff --git a/themes/next/config_next.js b/themes/next/config_next.js index 5504b8df..d341cee0 100644 --- a/themes/next/config_next.js +++ b/themes/next/config_next.js @@ -30,7 +30,6 @@ const CONFIG_NEXT = { WIDGET_DARK_MODE: false, // 显示日间/夜间模式切换 WIDGET_TOC: true, // 移动端显示悬浮目录 - ARTICLE_SHARE: process.env.NEXT_PUBLIC_ARTICLE_SHARE || false, // 文章分享功能 ARTICLE_RELATE_POSTS: true, // 相关文章推荐 ARTICLE_COPYRIGHT: true // 文章版权声明 diff --git a/themes/nobelium/LayoutSlug.js b/themes/nobelium/LayoutSlug.js index d60062a0..d27628af 100644 --- a/themes/nobelium/LayoutSlug.js +++ b/themes/nobelium/LayoutSlug.js @@ -4,6 +4,7 @@ import NotionPage from '@/components/NotionPage' import { ArticleInfo } from './components/ArticleInfo' import Comment from '@/components/Comment' import { ArticleFooter } from './components/ArticleFooter' +import ShareBar from '@/components/ShareBar' export const LayoutSlug = props => { const { post, lock, validPassword } = props @@ -21,6 +22,7 @@ export const LayoutSlug = props => { {post && <> + } diff --git a/themes/simple/LayoutSlug.js b/themes/simple/LayoutSlug.js index 6cf7c82b..d0cd2a1d 100644 --- a/themes/simple/LayoutSlug.js +++ b/themes/simple/LayoutSlug.js @@ -4,6 +4,7 @@ import NotionPage from '@/components/NotionPage' import { ArticleInfo } from './components/ArticleInfo' import Comment from '@/components/Comment' import ArticleAround from './components/ArticleAround' +import ShareBar from '@/components/ShareBar' export const LayoutSlug = props => { const { post, lock, validPassword, prev, next } = props @@ -23,6 +24,8 @@ export const LayoutSlug = props => { {post.type === 'Post' && } + {/* 分享 */} + }
} From 90a430299d08b43fe941012ae03aafa40e5b5555 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Apr 2023 15:34:26 +0800 Subject: [PATCH 09/40] readme --- README_EN.md | 9 ++++++--- package.json | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README_EN.md b/README_EN.md index b2a9f85c..dbb75684 100644 --- a/README_EN.md +++ b/README_EN.md @@ -35,12 +35,15 @@ Live Demo:[https://preview.tangly1024.com/](https://preview.tangly1024.com/) It only takes a few minutes to set up your personal site: -- [快速部署教程 - 多种方案可供选择](https://tangly1024.com/article/notion-next) +- [Quick Deployment Tutorial - Multiple Options Available](https://tangly1024.com/article/notion-next) -- [个性配置手册 - 如何配置功能插件](https://tangly1024.com/article/notion-next-guide) +- [Customization Guide - How to Configure Feature Plugins](https://tangly1024.com/article/notion-next-guide) -- [二次开发指引 - 如何进行本地开发](https://tangly1024.com/article/how-to-develop-with-notion-next) +- [Development Guide - How to Conduct Local Development](https://tangly1024.com/article/how-to-develop-with-notion-next) +- [Update Guide - How to Get the Latest Upgrade Patch](https://tangly1024.com/article/how-to-update-notionnext) + +- [Version History - Check Feature Highlights for Each Version](https://tangly1024.com/article/notion-next-changelogs) ## Acknowledgements diff --git a/package.json b/package.json index 58e579fd..8bd5a1df 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "react-facebook": "^8.1.4", "react-messenger-customer-chat": "^0.8.0", "react-notion-x": "6.16.0", - "react-share": "^4.4.0", + "react-share": "^4.4.1", "react-tweet-embed": "~2.0.0", "smoothscroll-polyfill": "^0.4.4", "twikoo": "^1.6.16", From c71d51c8002f78c18fa33dfeb1a7611842d86402 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Apr 2023 15:34:32 +0800 Subject: [PATCH 10/40] readme --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2fefab40..2505564c 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,10 @@ - [个性配置手册 - 如何配置功能插件](https://tangly1024.com/article/notion-next-guide) - [二次开发指引 - 如何进行本地开发](https://tangly1024.com/article/how-to-develop-with-notion-next) - + +- [更新操作指南 - 获取最新升级补丁](https://tangly1024.com/article/how-to-update-notionnext) + +- [历史版本汇总 - 查询版本功能特性](https://tangly1024.com/article/notion-next-changelogs) ## 致谢 感谢Craig Hart发起的Nobelium项目 From 4ca8f39a6bb4dd6caaaefe746e5b47425c2343e4 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Apr 2023 16:11:01 +0800 Subject: [PATCH 11/40] =?UTF-8?q?feat=20-=20=E5=88=86=E4=BA=AB=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- blog.config.js | 4 +- components/ShareBar.js | 82 ++------ components/ShareButton.js | 34 ---- components/ShareButtons.js | 370 +++++++++++++++++++++++++++++++++++++ lib/lang/zh-CN.js | 2 +- 5 files changed, 385 insertions(+), 107 deletions(-) delete mode 100644 components/ShareButton.js create mode 100644 components/ShareButtons.js diff --git a/blog.config.js b/blog.config.js index 1b01e9dc..fa0fad99 100644 --- a/blog.config.js +++ b/blog.config.js @@ -96,7 +96,9 @@ const BLOG = { BACKGROUND_DARK: '#000000', // use hex value, don't forget '#' SUB_PATH: '', // leave this empty unless you want to deploy in a folder - POST_SHARE_BAR_ENABLE: process.env.NEXT_PUBLIC_POST_SHARE_BAR || 'false', // 文章分享功能 ,将在底部显示一个分享条 + POST_SHARE_BAR_ENABLE: process.env.NEXT_PUBLIC_POST_SHARE_BAR || 'true', // 文章分享功能 ,将在底部显示一个分享条 + POSTS_SHARE_SERVICES: process.env.NEXT_PUBLIC_POST_SHARE_SERVICES || 'link,wechat,qq,weibo,email,facebook,twitter,telegram,messenger,line,reddit,whatsapp,linkedin', // 分享的服務,选填逗号隔开 + // 所有支持的分享服务:link(复制链接),wechat(微信),qq,weibo(微博),email(邮件),facebook,twitter,telegram,messenger,line,reddit,whatsapp,linkedin,vkshare,okshare,tumblr,livejournal,mailru,viber,workplace,pocket,instapaper,hatena POST_URL_PREFIX: process.env.NEXT_PUBLIC_POST_URL_PREFIX || 'article', // POST类型文章的默认路径前缀,例如默认POST类型的路径是 /article/[slug] diff --git a/components/ShareBar.js b/components/ShareBar.js index 97f46395..1cf57776 100644 --- a/components/ShareBar.js +++ b/components/ShareBar.js @@ -1,15 +1,10 @@ import BLOG from '@/blog.config' import { useRouter } from 'next/router' import React from 'react' -import { createPopper } from '@popperjs/core' -import copy from 'copy-to-clipboard' -import QRCode from 'qrcode.react' -import { useGlobal } from '@/lib/global' +import ShareButtons from './ShareButtons' const ShareBar = ({ post }) => { const router = useRouter() - const [qrCodeShow, setQrCodeShow] = React.useState(false) - const { locale } = useGlobal() if (!JSON.parse(BLOG.POST_SHARE_BAR_ENABLE) || !post || post?.type !== 'Post') { return <> @@ -17,71 +12,16 @@ const ShareBar = ({ post }) => { const shareUrl = BLOG.LINK + router.asPath - // 二维码悬浮 - const btnRef = React.createRef() - const popoverRef = React.createRef() - - const openPopover = () => { - createPopper(btnRef.current, popoverRef.current, { - placement: 'top' - }) - setQrCodeShow(true) - } - const closePopover = () => { - setQrCodeShow(false) - } - - const copyUrl = () => { - copy(shareUrl) - alert(locale.COMMON.URL_COPIED) - } - - return
-
{locale.COMMON.SHARE}:
-
- - - -
-
- - - -
-
- - - -
- -
- - - -
-
- - - -
-
- - - -
+ return
+
} export default ShareBar diff --git a/components/ShareButton.js b/components/ShareButton.js deleted file mode 100644 index 39fea1f2..00000000 --- a/components/ShareButton.js +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react' -import ShareBar from './ShareBar' - -/** - * 悬浮在屏幕右下角,分享按钮 - * @returns {JSX.Element} - * @constructor - */ -const ShareButton = ({ post }) => { - const [popoverShow, setPopoverShow] = React.useState(false) - const btnRef = React.createRef() - - const openPopover = () => { - setPopoverShow(true) - } - const closePopover = () => { - setPopoverShow(false) - } - return ( -
{ openPopover() }} - onMouseLeave={() => { closePopover() }}> -
- -
-
- -
-
- ) -} - -export default ShareButton diff --git a/components/ShareButtons.js b/components/ShareButtons.js new file mode 100644 index 00000000..cc686d55 --- /dev/null +++ b/components/ShareButtons.js @@ -0,0 +1,370 @@ +import BLOG from '@/blog.config' +import { useGlobal } from '@/lib/global' +import copy from 'copy-to-clipboard' +import QRCode from 'qrcode.react' +import { useState } from 'react' + +import { + FacebookShareButton, + FacebookIcon, + FacebookMessengerShareButton, + FacebookMessengerIcon, + RedditShareButton, + RedditIcon, + LineShareButton, + LineIcon, + EmailShareButton, + EmailIcon, + TwitterShareButton, + TwitterIcon, + TelegramShareButton, + TelegramIcon, + WhatsappShareButton, + WhatsappIcon, + LinkedinShareButton, + LinkedinIcon, + PinterestShareButton, + PinterestIcon, + VKIcon, + VKShareButton, + OKShareButton, + OKIcon, + TumblrShareButton, + TumblrIcon, + LivejournalIcon, + LivejournalShareButton, + MailruShareButton, + MailruIcon, + ViberIcon, + ViberShareButton, + WorkplaceShareButton, + WorkplaceIcon, + WeiboShareButton, + WeiboIcon, + PocketShareButton, + PocketIcon, + InstapaperShareButton, + InstapaperIcon, + HatenaShareButton, + HatenaIcon +} from 'react-share' + +/** + * @author https://github.com/txs + * @param {*} param0 + * @returns + */ +const ShareButtons = ({ shareUrl, title, body, image }) => { + const services = BLOG.POSTS_SHARE_SERVICES.split(',') + const titleWithSiteInfo = title + ' | ' + BLOG.TITLE + const { locale } = useGlobal() + const [qrCodeShow, setQrCodeShow] = useState(false) + + const copyUrl = () => { + copy(shareUrl) + alert(locale.COMMON.URL_COPIED) + } + + const openPopover = () => { + setQrCodeShow(true) + } + const closePopover = () => { + setQrCodeShow(false) + } + + return ( + <> + {services.map(singleService => { + if (singleService === 'facebook') { + return ( + + + + ) + } + if (singleService === 'messenger') { + return ( + + + + ) + } + if (singleService === 'line') { + return ( + + + + ) + } + if (singleService === 'reddit') { + return ( + + + + ) + } + if (singleService === 'email') { + return ( + + + + ) + } + if (singleService === 'twitter') { + return ( + + + + ) + } + if (singleService === 'telegram') { + return ( + + + + ) + } + if (singleService === 'whatsapp') { + return ( + + + + ) + } + if (singleService === 'linkedin') { + return ( + + + + ) + } + if (singleService === 'pinterest') { + return ( + + + + ) + } + if (singleService === 'vkshare') { + return ( + + + + ) + } + if (singleService === 'okshare') { + return ( + + + + ) + } + if (singleService === 'tumblr') { + return ( + + + + ) + } + if (singleService === 'livejournal') { + return ( + + + + ) + } + if (singleService === 'mailru') { + return ( + + + + ) + } + if (singleService === 'viber') { + return ( + + + + ) + } + if (singleService === 'workplace') { + return ( + + + + ) + } + if (singleService === 'weibo') { + return ( + + + + ) + } + if (singleService === 'pocket') { + return ( + + + + ) + } + if (singleService === 'instapaper') { + return ( + + + + ) + } + if (singleService === 'hatena') { + return ( + + + + ) + } + if (singleService === 'qq') { + return + } + if (singleService === 'wechat') { + return + } + if (singleService === 'link') { + return + } + return <> + })} + + ) +} + +export default ShareButtons diff --git a/lib/lang/zh-CN.js b/lib/lang/zh-CN.js index 1dddddb9..8379c75f 100644 --- a/lib/lang/zh-CN.js +++ b/lib/lang/zh-CN.js @@ -17,7 +17,7 @@ export default { NO_TAG: 'NoTag', CATEGORY: '分类', SHARE: '分享', - SCAN_QR_CODE: '扫一扫二维码', + SCAN_QR_CODE: '微信扫码分享', URL_COPIED: '链接已复制!', TABLE_OF_CONTENTS: '目录', RELATE_POSTS: '相关文章', From 15a59f61f87c13a5ddde20adcdc90a6a4e4242ff Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Apr 2023 16:13:07 +0800 Subject: [PATCH 12/40] config --- blog.config.js | 2 +- package.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/blog.config.js b/blog.config.js index fa0fad99..7ea32205 100644 --- a/blog.config.js +++ b/blog.config.js @@ -97,7 +97,7 @@ const BLOG = { SUB_PATH: '', // leave this empty unless you want to deploy in a folder POST_SHARE_BAR_ENABLE: process.env.NEXT_PUBLIC_POST_SHARE_BAR || 'true', // 文章分享功能 ,将在底部显示一个分享条 - POSTS_SHARE_SERVICES: process.env.NEXT_PUBLIC_POST_SHARE_SERVICES || 'link,wechat,qq,weibo,email,facebook,twitter,telegram,messenger,line,reddit,whatsapp,linkedin', // 分享的服務,选填逗号隔开 + POSTS_SHARE_SERVICES: process.env.NEXT_PUBLIC_POST_SHARE_SERVICES || 'link,wechat,qq,weibo,email,facebook,twitter,telegram,messenger,line,reddit,whatsapp,linkedin', // 分享的服務,按顺序显示,逗号隔开 // 所有支持的分享服务:link(复制链接),wechat(微信),qq,weibo(微博),email(邮件),facebook,twitter,telegram,messenger,line,reddit,whatsapp,linkedin,vkshare,okshare,tumblr,livejournal,mailru,viber,workplace,pocket,instapaper,hatena POST_URL_PREFIX: process.env.NEXT_PUBLIC_POST_URL_PREFIX || 'article', diff --git a/package.json b/package.json index 8bd5a1df..372d36fe 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ "dependencies": { "@giscus/react": "^2.2.6", "@next/bundle-analyzer": "^12.1.1", - "@popperjs/core": "^2.9.3", "@vercel/analytics": "^1.0.0", "animate.css": "^4.1.1", "animejs": "^3.2.1", From d44edb2d85bd92afeeb5cf9424e60d9e498d3dd1 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Apr 2023 16:14:00 +0800 Subject: [PATCH 13/40] v3.13.5 --- .env.local | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.local b/.env.local index fd53e2f4..35e50011 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.13.4 \ No newline at end of file +NEXT_PUBLIC_VERSION=3.13.5 \ No newline at end of file diff --git a/package.json b/package.json index 372d36fe..db5d13fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "notion-next", - "version": "3.13.4", + "version": "3.13.5", "homepage": "https://github.com/tangly1024/NotionNext.git", "license": "MIT", "repository": { From 262dca325189e29f9c5fcde9f2ec0de16b2e0156 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Apr 2023 16:19:51 +0800 Subject: [PATCH 14/40] =?UTF-8?q?=E5=88=86=E4=BA=AB=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ShareBar.js | 2 +- components/ShareButtons.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/ShareBar.js b/components/ShareBar.js index 1cf57776..39f7c3d9 100644 --- a/components/ShareBar.js +++ b/components/ShareBar.js @@ -12,7 +12,7 @@ const ShareBar = ({ post }) => { const shareUrl = BLOG.LINK + router.asPath - return
+ return
{ ) } if (singleService === 'qq') { - return } if (singleService === 'wechat') { - return } if (singleService === 'link') { - return } From abd80f4c8d537c582ebec0af19d05bf7571ca167 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Apr 2023 16:39:52 +0800 Subject: [PATCH 15/40] sharebar position --- components/ShareBar.js | 2 +- components/ShareButtons.js | 4 +++- themes/hexo/LayoutSlug.js | 5 ++--- themes/matery/LayoutSlug.js | 6 +++--- themes/medium/LayoutSlug.js | 7 +++++-- themes/next/components/ArticleDetail.js | 7 ++++--- themes/simple/LayoutSlug.js | 2 +- 7 files changed, 19 insertions(+), 14 deletions(-) diff --git a/components/ShareBar.js b/components/ShareBar.js index 39f7c3d9..347dc16e 100644 --- a/components/ShareBar.js +++ b/components/ShareBar.js @@ -12,7 +12,7 @@ const ShareBar = ({ post }) => { const shareUrl = BLOG.LINK + router.asPath - return
+ return
{ } if (singleService === 'wechat') { - return } if (singleService === 'link') { diff --git a/themes/hexo/LayoutSlug.js b/themes/hexo/LayoutSlug.js index cc9bdab5..69478a09 100644 --- a/themes/hexo/LayoutSlug.js +++ b/themes/hexo/LayoutSlug.js @@ -69,6 +69,8 @@ export const LayoutSlug = props => { data-ad-slot="3806269138" /> + {/* 分享 */} + {post.type === 'Post' && } {post.type === 'Post' && } {post.type === 'Post' && } @@ -77,9 +79,6 @@ export const LayoutSlug = props => {
- {/* 分享 */} - - {/* 评论互动 */}
diff --git a/themes/matery/LayoutSlug.js b/themes/matery/LayoutSlug.js index e938942b..da07db06 100644 --- a/themes/matery/LayoutSlug.js +++ b/themes/matery/LayoutSlug.js @@ -81,15 +81,15 @@ export const LayoutSlug = props => { data-ad-client="ca-pub-2708419466378217" data-ad-slot="3806269138" /> - + {/* 分享 */} + {/* 文章版权说明 */} {post.type === 'Post' && }
- {/* 分享 */} - + {/* 评论互动 */}
diff --git a/themes/medium/LayoutSlug.js b/themes/medium/LayoutSlug.js index b6d54077..401c4a03 100644 --- a/themes/medium/LayoutSlug.js +++ b/themes/medium/LayoutSlug.js @@ -86,15 +86,18 @@ export const LayoutSlug = props => {
+ + {/* 分享 */} + + {/* 文章分类和标签信息 */}
{CONFIG_MEDIUM.POST_DETAIL_CATEGORY && post.category && }
{CONFIG_MEDIUM.POST_DETAIL_TAG && post?.tagItems?.map(tag => )}
+ {post.type === 'Post' && } - {/* 分享 */} -
diff --git a/themes/next/components/ArticleDetail.js b/themes/next/components/ArticleDetail.js index 75fc7f7d..c0c2efac 100644 --- a/themes/next/components/ArticleDetail.js +++ b/themes/next/components/ArticleDetail.js @@ -94,15 +94,16 @@ export default function ArticleDetail(props) { {showArticleInfo && <> + + {/* 分享 */} + + {/* 版权声明 */} {post.type === 'Post' && } {/* 推荐文章 */} {post.type === 'Post' && } - {/* 分享 */} - -
{/* 分类 */} {post.category && <> diff --git a/themes/simple/LayoutSlug.js b/themes/simple/LayoutSlug.js index d0cd2a1d..96f42c3e 100644 --- a/themes/simple/LayoutSlug.js +++ b/themes/simple/LayoutSlug.js @@ -23,9 +23,9 @@ export const LayoutSlug = props => { {post && <> - {post.type === 'Post' && } {/* 分享 */} + {post.type === 'Post' && } }
} From 477cdf99e491576e35c223f1c122b034405ff8eb Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 26 Apr 2023 16:46:36 +0800 Subject: [PATCH 16/40] fontawesome --- blog.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blog.config.js b/blog.config.js index 7ea32205..c51d97a2 100644 --- a/blog.config.js +++ b/blog.config.js @@ -66,7 +66,7 @@ const BLOG = { '"Segoe UI Symbol"', '"Apple Color Emoji"' ], - FONT_AWESOME: '/css/all.min.css', // font-awesome 字体图标地址、默认读取本地; 可选 https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/font-awesome/6.0.0/css/all.min.css + FONT_AWESOME: process.env.NEXT_PUBLIC_FONT_AWESOME_PATH || '/css/all.min.css', // font-awesome 字体图标地址、默认读取本地; 可选 https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/font-awesome/6.0.0/css/all.min.css // 自定义外部脚本,外部样式 CUSTOM_EXTERNAL_JS: [''], // e.g. ['http://xx.com/script.js','http://xx.com/script.js'] From 671c428e206e810cfa9caba71a114a89e1c4885c Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Wed, 3 May 2023 14:28:04 +0800 Subject: [PATCH 17/40] =?UTF-8?q?sharebar-=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ShareBar.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/ShareBar.js b/components/ShareBar.js index 347dc16e..b55c4dc9 100644 --- a/components/ShareBar.js +++ b/components/ShareBar.js @@ -12,7 +12,8 @@ const ShareBar = ({ post }) => { const shareUrl = BLOG.LINK + router.asPath - return
+ return
+
{ ' ' + post.summary } /> +
} export default ShareBar From 2db7b473ddc972e52f23ea3bb671b46504c5147a Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Wed, 3 May 2023 15:10:10 +0800 Subject: [PATCH 18/40] =?UTF-8?q?=E7=A8=B3=E5=AE=9Anextjs=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index db5d13fc..3e855451 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "memory-cache": "^0.2.0", "mermaid": "9.2.2", "mongodb": "^4.6.0", - "next": "^13.1.1", + "next": "13.3.1", "notion-client": "6.15.6", "notion-utils": "6.15.6", "nprogress": "^0.2.0", From 0319acea704d9a48e74780c3bdd269ff4da5f2b8 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Thu, 4 May 2023 18:24:47 +0800 Subject: [PATCH 19/40] =?UTF-8?q?matery=20=E5=85=AC=E5=91=8A=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/DebugPanel.js | 2 +- lib/lang/en-US.js | 3 +- lib/lang/zh-CN.js | 3 +- themes/matery/LayoutBase.js | 19 +-- themes/matery/LayoutIndex.js | 3 +- themes/matery/LayoutSlug.js | 133 +++++++++--------- themes/matery/components/Announcement.js | 29 ++++ themes/matery/components/BlogPostListPage.js | 2 +- .../matery/components/BlogPostListScroll.js | 2 +- .../matery/components/FloatDarkModeButton.js | 5 +- themes/matery/components/Header.js | 7 +- .../matery/components/JumpToCommentButton.js | 9 +- themes/matery/components/JumpToTopButton.js | 13 +- 13 files changed, 134 insertions(+), 96 deletions(-) create mode 100644 themes/matery/components/Announcement.js diff --git a/components/DebugPanel.js b/components/DebugPanel.js index 01e3c579..55c4a465 100644 --- a/components/DebugPanel.js +++ b/components/DebugPanel.js @@ -58,7 +58,7 @@ export function DebugPanel() {
{show diff --git a/lib/lang/en-US.js b/lib/lang/en-US.js index 10ac5bf9..58bec1e5 100644 --- a/lib/lang/en-US.js +++ b/lib/lang/en-US.js @@ -39,7 +39,8 @@ export default { DEBUG_OPEN: 'Debug', DEBUG_CLOSE: 'Close', THEME_SWITCH: 'Theme Switch', - ANNOUNCEMENT: 'Announcement' + ANNOUNCEMENT: 'Announcement', + START_READING: 'Start Reading' }, PAGINATION: { PREV: 'Prev', diff --git a/lib/lang/zh-CN.js b/lib/lang/zh-CN.js index 8379c75f..511bb3bf 100644 --- a/lib/lang/zh-CN.js +++ b/lib/lang/zh-CN.js @@ -41,7 +41,8 @@ export default { DEBUG_OPEN: '开启调试', DEBUG_CLOSE: '关闭调试', THEME_SWITCH: '切换主题', - ANNOUNCEMENT: '公告' + ANNOUNCEMENT: '公告', + START_READING: '开始阅读' }, PAGINATION: { PREV: '上一页', diff --git a/themes/matery/LayoutBase.js b/themes/matery/LayoutBase.js index fb5df18e..0fcba177 100644 --- a/themes/matery/LayoutBase.js +++ b/themes/matery/LayoutBase.js @@ -51,9 +51,15 @@ const LayoutBase = props => { {headerSlot}
+ {/* 嵌入区域 */} +
+ {props.containerSlot} +
+
{onLoading ? : children}
+
{/* 左下角悬浮 */} @@ -61,15 +67,12 @@ const LayoutBase = props => {
-
- -
- {/* 右下角悬浮 */} -