diff --git a/themes/movie/index.js b/themes/movie/index.js
index 00b90346c4e..6e969b7d7f3 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 48b3aaba64e..ed405186e97 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 ccf146d453b..6cfd1cc6336 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 b7408f8a327..8c70fb8ff81 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 ed2b6ea6ea4..c8324277afa 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 f369e6fb28c..b76eef756ce 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 be778f685b7..4de0ba0a288 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 397e6a69d34..020bbf4e215 100644
--- a/themes/simple/index.js
+++ b/themes/simple/index.js
@@ -224,35 +224,37 @@ const LayoutSlug = props => {
<>
{lock &&
}
-
- {/* 文章信息 */}
-
-
- {/* 广告嵌入 */}
- {/*
*/}
-
-
-
- {/* Notion文章主体 */}
- {!lock && }
-
+ {!lock && post && (
+
+ {/* 文章信息 */}
+
+
+ {/* 广告嵌入 */}
+ {/*
*/}
+
+
+
+ {/* 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 35d837bd559..c4f9af8c032 100644
--- a/themes/starter/index.js
+++ b/themes/starter/index.js
@@ -159,7 +159,7 @@ const LayoutSlug = props => {
{lock &&
}
- {!lock && (
+ {!lock && post && (