diff --git a/themes/medium/LayoutSlug.js b/themes/medium/LayoutSlug.js index f9242af0..e0c52b84 100644 --- a/themes/medium/LayoutSlug.js +++ b/themes/medium/LayoutSlug.js @@ -9,6 +9,8 @@ import { ArticleLock } from './components/ArticleLock' export const LayoutSlug = props => { const { post, lock, validPassword } = props + const { locale } = useGlobal() + if (!post) { return { post.content = Object.keys(post.blockMap.block) post.toc = getPageTableOfContents(post, post.blockMap) } - const { locale } = useGlobal() const slotRight = post?.toc && post?.toc?.length > 3 && (
diff --git a/themes/medium/components/ArticleDetail.js b/themes/medium/components/ArticleDetail.js index 48630d47..5e6c4da5 100644 --- a/themes/medium/components/ArticleDetail.js +++ b/themes/medium/components/ArticleDetail.js @@ -19,55 +19,58 @@ export const ArticleDetail = props => { locale.LOCALE ) return
-

{post?.title}

-
- - <> - {/* eslint-disable-next-line @next/next/no-img-element */} - + {/* title */} +

{post?.title}

-
- {BLOG.AUTHOR} -
- - -
{date}
-
- {locale.COMMON.LAST_EDITED_TIME}: {post.lastEditedTime} -
-
- -   - -
-
- {/* Notion文章主体 */} -
- {post && ()} -
+ {/* meta */} +
+
+ {date} + | + {post.lastEditedTime} +
+ + +
+
+ +
+ {/* eslint-disable-next-line @next/next/no-img-element */} + -
- {/* 文章内嵌广告 */} - -
-
-
- {CONFIG_MEDIUM.POST_DETAIL_CATEGORY && post.category && } -
- {CONFIG_MEDIUM.POST_DETAIL_TAG && post?.tagItems?.map(tag => )} -
-
- {post.type === 'Post' && } - -
-
+
+ {BLOG.AUTHOR} +
+
+ + + {/* Notion文章主体 */} +
+ {post && ()} +
+ +
+ {/* 文章内嵌广告 */} + +
+
+
+ {CONFIG_MEDIUM.POST_DETAIL_CATEGORY && post.category && } +
+ {CONFIG_MEDIUM.POST_DETAIL_TAG && post?.tagItems?.map(tag => )} +
+
+ {post.type === 'Post' && } + +
+
} diff --git a/themes/next/LayoutSlug.js b/themes/next/LayoutSlug.js index 9e1b0341..aa1cc4d2 100644 --- a/themes/next/LayoutSlug.js +++ b/themes/next/LayoutSlug.js @@ -12,15 +12,6 @@ import { isBrowser } from '@/lib/utils' export const LayoutSlug = (props) => { const { post, latestPosts, lock, validPassword } = props - if (!post) { - return - } - /> - } - if (!lock && post?.blockMap?.block) { post.content = Object.keys(post.blockMap.block) post.toc = getPageTableOfContents(post, post.blockMap) @@ -34,6 +25,15 @@ export const LayoutSlug = (props) => { }} /> : null + if (!post) { + return + } + /> + } + return ( -
+
- {showArticleInfo &&
- {CONFIG_NEXT.POST_HEADER_IMAGE_VISIBLE && post?.type && !post?.type !== 'Page' && post?.page_cover && ( -
- {/* eslint-disable-next-line @next/next/no-img-element */} - {post.title} -
- )} + {showArticleInfo &&
+ {/* 头图 */} + {CONFIG_NEXT.POST_HEADER_IMAGE_VISIBLE && post?.type && !post?.type !== 'Page' && post?.page_cover && ( +
+ {/* eslint-disable-next-line @next/next/no-img-element */} + {post.title} +
+ )} - {/* 文章Title */} -
- {post.title} + {/* title */} +
+ {post.title} +
+ + {/* meta */} +
+
+ {post?.type !== 'Page' && (<> + +
+ {date} +
+ + | {post.lastEditedTime} + +
+ + +
+ + )} +
+ + +
+ +
} + + {/* Notion内容主体 */} +
+ {post && ()} +
+ +
+ {/* 文章内嵌广告 */} + +
+ + {showArticleInfo && <> + {/* 版权声明 */} + {post.type === 'Post' && } + + {/* 推荐文章 */} + {post.type === 'Post' && } + +
+ {/* 分类 */} + {post.category && <> +
+ + <> {post.category} + +
+ + } + + {/* 标签列表 */} + {post.type === 'Post' && ( + <> + {post.tagItems && ( +
+
+ {locale.COMMON.TAGS}: +
+ {post.tagItems.map(tag => ( + + ))} +
+ )} + + + )} +
+ {post.type === 'Post' && } + } + + {/* 评论互动 */} +
+ +
-
-
- {post.category && <> - - - {post.category} - - - | - } - {post?.type !== 'Page' && (<> - - - {date} - - - | -
- -   - -
- - )} - -
- -
- {locale.COMMON.LAST_EDITED_TIME} {post.lastEditedTime} -
- -
- -
-
- - } - - {/* Notion内容主体 */} -
- {post && ()} -
- -
- {/* 文章内嵌广告 */} - -
- - {showArticleInfo && <> - {/* 版权声明 */} - {post.type === 'Post' && } - - {/* 推荐文章 */} - {post.type === 'Post' && } - - {/* 标签列表 */} - {post.type === 'Post' && ( -
- {post.tagItems && ( -
-
- {locale.COMMON.TAGS}: -
- {post.tagItems.map(tag => ( - - ))} -
- )} -
- -
-
- )} - - {post.type === 'Post' && } - } - - {/* 评论互动 */} -
- -
-
- - ) + ) } diff --git a/themes/next/components/WordCount.js b/themes/next/components/WordCount.js index bad2cf3a..2062e69a 100644 --- a/themes/next/components/WordCount.js +++ b/themes/next/components/WordCount.js @@ -9,8 +9,8 @@ export default function WordCount() { countWords() }) - return
- 本文字数 0  |  阅读时长 ≈ 0 分钟 + return
+ 本文字数 0  |  阅读时长 ≈ 0 分钟
}