diff --git a/components/WordCount.js b/components/WordCount.js index 315c58d3..7f7066cf 100644 --- a/components/WordCount.js +++ b/components/WordCount.js @@ -28,7 +28,7 @@ export default function WordCount() { * 更新字数统计和阅读时间 */ function countWords() { - const articleText = deleteHtmlTag(document.getElementById('notion-article')?.innerHTML) + const articleText = deleteHtmlTag(document.querySelector('#article-wrapper #notion-article')?.innerHTML) const wordCount = fnGetCpmisWords(articleText) // 阅读速度 300-500每分钟 document.getElementById('wordCount').innerHTML = wordCount diff --git a/themes/commerce/index.js b/themes/commerce/index.js index 7ced2e85..9efbd684 100644 --- a/themes/commerce/index.js +++ b/themes/commerce/index.js @@ -246,7 +246,7 @@ const LayoutSlug = props => {
{lock && } - {!lock && ( + {!lock && post && (
@@ -304,7 +304,7 @@ const Layout404 = props => { // 延时3秒如果加载失败就返回首页 setTimeout(() => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/').then(() => { // console.log('找不到页面', router.asPath) diff --git a/themes/example/index.js b/themes/example/index.js index 60b896c1..d78e20a4 100644 --- a/themes/example/index.js +++ b/themes/example/index.js @@ -162,7 +162,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) @@ -178,7 +178,7 @@ const LayoutSlug = props => { <> {lock ? ( - ) : ( + ) : post && (
diff --git a/themes/fukasawa/index.js b/themes/fukasawa/index.js index 96936df8..0e2cf9d3 100644 --- a/themes/fukasawa/index.js +++ b/themes/fukasawa/index.js @@ -143,7 +143,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) @@ -159,7 +159,7 @@ const LayoutSlug = props => { <> {lock ? ( - ) : ( + ) : post && ( )} diff --git a/themes/game/index.js b/themes/game/index.js index 718f6a92..04bc192c 100644 --- a/themes/game/index.js +++ b/themes/game/index.js @@ -307,7 +307,7 @@ const LayoutSlug = props => { <> {lock && } - {!lock && ( + {!lock && post && (
diff --git a/themes/gitbook/index.js b/themes/gitbook/index.js index 9898f0ae..0fac89b5 100644 --- a/themes/gitbook/index.js +++ b/themes/gitbook/index.js @@ -255,7 +255,7 @@ const LayoutIndex = props => { // 重定向到指定文章 router.push(index).then(() => { setTimeout(() => { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { console.log( '请检查您的Notion数据库中是否包含此slug页面: ', @@ -309,7 +309,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) diff --git a/themes/heo/index.js b/themes/heo/index.js index 9bab5daf..aafe116e 100644 --- a/themes/heo/index.js +++ b/themes/heo/index.js @@ -273,7 +273,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) @@ -292,7 +292,7 @@ const LayoutSlug = props => { {/* 文章锁 */} {lock && } - {!lock && ( + {!lock && post && (
{/* 文章主体 */}
{ setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) @@ -286,7 +286,7 @@ const LayoutSlug = props => {
{lock && } - {!lock && ( + {!lock && post && (
{ // 延时3秒如果加载失败就返回首页 setTimeout(() => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/').then(() => { // console.log('找不到页面', router.asPath) diff --git a/themes/landing/index.js b/themes/landing/index.js index 62d8f9db..9dbb3be6 100644 --- a/themes/landing/index.js +++ b/themes/landing/index.js @@ -82,7 +82,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) diff --git a/themes/magzine/index.js b/themes/magzine/index.js index 1b01c3bb..e5165bdd 100644 --- a/themes/magzine/index.js +++ b/themes/magzine/index.js @@ -155,7 +155,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) @@ -177,7 +177,7 @@ const LayoutSlug = props => { {/* 文章锁 */} {lock && } - {!lock && ( + {!lock && post && (
{/* 文章信息 */} diff --git a/themes/matery/components/WordCount.js b/themes/matery/components/WordCount.js index 8e4af32a..d7d7c02b 100644 --- a/themes/matery/components/WordCount.js +++ b/themes/matery/components/WordCount.js @@ -29,7 +29,7 @@ export default function WordCount() { * 更新字数统计和阅读时间 */ function countWords() { - const articleText = deleteHtmlTag(document.getElementById('notion-article')?.innerHTML) + const articleText = deleteHtmlTag(document.querySelector('#article-wrapper #notion-article')?.innerHTML) const wordCount = fnGetCpmisWords(articleText) // 阅读速度 300-500每分钟 document.getElementById('wordCount').innerHTML = wordCount diff --git a/themes/matery/index.js b/themes/matery/index.js index 7cbcad19..cb844a5d 100644 --- a/themes/matery/index.js +++ b/themes/matery/index.js @@ -231,7 +231,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) @@ -253,7 +253,7 @@ const LayoutSlug = props => { className={`${fullWidth ? '' : '-mt-32'} transition-all duration-300 rounded-md mx-3 lg:border lg:rounded-xl lg:py-4 bg-white dark:bg-hexo-black-gray dark:border-black`}> {lock && } - {!lock && ( + {!lock && post && (
{/* 文章信息 */} {post?.type && post?.type === 'Post' && ( @@ -320,7 +320,7 @@ const Layout404 = props => { setTimeout(() => { const article = typeof document !== 'undefined' && - document.getElementById('notion-article') + document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/').then(() => { // console.log('找不到页面', router.asPath) diff --git a/themes/medium/index.js b/themes/medium/index.js index ee5eb121..dfd37ce2 100644 --- a/themes/medium/index.js +++ b/themes/medium/index.js @@ -191,7 +191,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) @@ -209,7 +209,7 @@ const LayoutSlug = props => { {/* 文章锁 */} {lock && } - {!lock && ( + {!lock && post && (
{/* 文章信息 */} diff --git a/themes/movie/index.js b/themes/movie/index.js index 00b90346..6e969b7d 100644 --- a/themes/movie/index.js +++ b/themes/movie/index.js @@ -156,7 +156,7 @@ const LayoutSlug = props => { // 用js 实现将页面中的多个视频聚合为一个分集的视频 function combineVideo() { // 找到 id 为 notion-article 的元素 - const notionArticle = document.getElementById('notion-article') + const notionArticle = document.querySelector('#article-wrapper #notion-article') if (!notionArticle) return // 如果找不到对应的元素,则退出函数 // 找到所有的 .notion-asset-wrapper 元素 @@ -291,7 +291,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) @@ -315,7 +315,7 @@ const LayoutSlug = props => { return ( <> - {!lock ? ( + {!lock ? post && (
diff --git a/themes/nav/index.js b/themes/nav/index.js index 48b3aaba..ed405186 100755 --- a/themes/nav/index.js +++ b/themes/nav/index.js @@ -261,7 +261,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) diff --git a/themes/next/components/WordCount.js b/themes/next/components/WordCount.js index ccf146d4..6cfd1cc6 100644 --- a/themes/next/components/WordCount.js +++ b/themes/next/components/WordCount.js @@ -23,7 +23,7 @@ export default function WordCount() { * 更新字数统计和阅读时间 */ function countWords() { - const articleText = deleteHtmlTag(document.getElementById('notion-article')?.innerHTML) + const articleText = deleteHtmlTag(document.querySelector('#article-wrapper #notion-article')?.innerHTML) const wordCount = fnGetCpmisWords(articleText) // 阅读速度 300-500每分钟 document.getElementById('wordCount').innerHTML = wordCount diff --git a/themes/next/index.js b/themes/next/index.js index b7408f8a..8c70fb8f 100644 --- a/themes/next/index.js +++ b/themes/next/index.js @@ -328,7 +328,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) diff --git a/themes/nobelium/index.js b/themes/nobelium/index.js index ed2b6ea6..c8324277 100644 --- a/themes/nobelium/index.js +++ b/themes/nobelium/index.js @@ -227,7 +227,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) @@ -243,7 +243,7 @@ const LayoutSlug = props => { <> {lock && } - {!lock && ( + {!lock && post && (
<> diff --git a/themes/photo/index.js b/themes/photo/index.js index f369e6fb..b76eef75 100644 --- a/themes/photo/index.js +++ b/themes/photo/index.js @@ -156,7 +156,7 @@ const LayoutSlug = props => { // 用js 实现将页面中的多个视频聚合为一个分集的视频 function combineVideo() { // 找到 id 为 notion-article 的元素 - const notionArticle = document.getElementById('notion-article') + const notionArticle = document.querySelector('#article-wrapper #notion-article') if (!notionArticle) return // 如果找不到对应的元素,则退出函数 // 找到所有的 .notion-asset-wrapper 元素 @@ -291,7 +291,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) @@ -315,7 +315,7 @@ const LayoutSlug = props => { return ( <> - {!lock ? ( + {!lock ? post && (
diff --git a/themes/plog/index.js b/themes/plog/index.js index be778f68..4de0ba0a 100644 --- a/themes/plog/index.js +++ b/themes/plog/index.js @@ -182,7 +182,7 @@ const LayoutSlug = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) @@ -198,7 +198,7 @@ const LayoutSlug = props => { <> {lock && } - {!lock && ( + {!lock && post && (
<> diff --git a/themes/simple/index.js b/themes/simple/index.js index 397e6a69..020bbf4e 100644 --- a/themes/simple/index.js +++ b/themes/simple/index.js @@ -224,35 +224,37 @@ const LayoutSlug = props => { <> {lock && } -
- {/* 文章信息 */} - + {!lock && post && ( +
+ {/* 文章信息 */} + - {/* 广告嵌入 */} - {/* */} - + {/* 广告嵌入 */} + {/* */} + -
- {/* Notion文章主体 */} - {!lock && } +
+ {/* Notion文章主体 */} + {!lock && } +
+ + {/* 分享 */} + + + {/* 广告嵌入 */} + + + {post?.type === 'Post' && ( + <> + + + + )} + + {/* 评论区 */} +
- - {/* 分享 */} - - - {/* 广告嵌入 */} - - - {post?.type === 'Post' && ( - <> - - - - )} - - {/* 评论区 */} - -
+ )} ) } @@ -271,7 +273,7 @@ const Layout404 = props => { setTimeout( () => { if (isBrowser) { - const article = document.getElementById('notion-article') + const article = document.querySelector('#article-wrapper #notion-article') if (!article) { router.push('/404').then(() => { console.warn('找不到页面', router.asPath) diff --git a/themes/starter/index.js b/themes/starter/index.js index 35d837bd..c4f9af8c 100644 --- a/themes/starter/index.js +++ b/themes/starter/index.js @@ -159,7 +159,7 @@ const LayoutSlug = props => {
{lock && } - {!lock && ( + {!lock && post && (