+
+
-
+ {/* 页头 */}
+
- {/* 页头 */}
-
+ {/* 主体 */}
+
+ {/* 标题栏 */}
+ {!fullWidth && (
+
+
+ {siteConfig('POST_TITLE_ICON') && (
+
+ )}
+ {title}
+
+
{description}
+
+ )}
- {/* 菜单 */}
-
+
+ {/* 内容 */}
+
+
+ {/* 嵌入模块 */}
+ {slotTop}
+ {children}
+
+
- {/* 主体 */}
-
-
- {/* 标题栏 */}
- {fullWidth ? null :
}
-
-
-
- {/* 内容 */}
-
-
- {/* 嵌入模块 */}
- {slotTop}
- {children}
-
-
-
- {/* 侧边栏 */}
- {!fullWidth &&
}
-
-
-
-
-
- {/* 页脚 */}
-
-
- {/* 回顶按钮 */}
-
-
-
+ {/* 侧边栏 */}
+ {!fullWidth &&
}
+
+
+ {/* 页脚 */}
+
+
+ {/* 回顶按钮 */}
+
+
window.scrollTo({ top: 0, behavior: 'smooth' })}>
+
+
+
+
)
}
@@ -133,9 +151,13 @@ const LayoutIndex = props => {
*/
const LayoutPostList = props => {
return (
- <>
- {siteConfig('POST_LIST_STYLE') === 'page' ?
:
}
- >
+ <>
+ {siteConfig('POST_LIST_STYLE') === 'page' ? (
+
+ ) : (
+
+ )}
+ >
)
}
@@ -150,29 +172,34 @@ const LayoutSlug = props => {
useEffect(() => {
// 404
if (!post) {
- setTimeout(() => {
- if (isBrowser) {
- const article = document.getElementById('notion-article')
- if (!article) {
- router.push('/404').then(() => {
- console.warn('找不到页面', router.asPath)
- })
+ setTimeout(
+ () => {
+ if (isBrowser) {
+ const article = document.getElementById('notion-article')
+ if (!article) {
+ router.push('/404').then(() => {
+ console.warn('找不到页面', router.asPath)
+ })
+ }
}
- }
- }, siteConfig('POST_WAITING_TIME_FOR_404') * 1000)
+ },
+ siteConfig('POST_WAITING_TIME_FOR_404') * 1000
+ )
}
}, [post])
return (
- <>
- {lock
- ?
- :
}
- >
+ <>
+ {lock ? (
+
+ ) : (
+
+ )}
+ >
)
}
@@ -181,7 +208,7 @@ const LayoutSlug = props => {
* @param {*} props
* @returns
*/
-const Layout404 = (props) => {
+const Layout404 = props => {
return <>404 Not found.>
}
@@ -220,13 +247,19 @@ const LayoutSearch = props => {
*/
const LayoutArchive = props => {
const { archivePosts } = props
- return (<>
-
- {Object.keys(archivePosts).map(archiveTitle => (
-
- ))}
-
- >)
+ return (
+ <>
+
+ {Object.keys(archivePosts).map(archiveTitle => (
+
+ ))}
+
+ >
+ )
}
/**
@@ -237,11 +270,25 @@ const LayoutArchive = props => {
const LayoutCategoryIndex = props => {
const { categoryOptions } = props
return (
- <>
-
- {categoryOptions?.map(category =>
)}
+ <>
+
+ {categoryOptions?.map(category => (
+
+
+
+ {category.name}({category.count})
- >
+
+ ))}
+
+ >
)
}
@@ -250,26 +297,39 @@ const LayoutCategoryIndex = props => {
* @param {*} props
* @returns
*/
-const LayoutTagIndex = (props) => {
+const LayoutTagIndex = props => {
const { tagOptions } = props
return (
- <>
-
- {tagOptions.map(tag => )}
-
- >
+ <>
+
+ >
)
}
export {
- CONFIG as THEME_CONFIG,
- LayoutBase,
- LayoutIndex,
- LayoutSearch,
- LayoutArchive,
- LayoutSlug,
Layout404,
- LayoutPostList,
+ LayoutArchive,
+ LayoutBase,
LayoutCategoryIndex,
- LayoutTagIndex
+ LayoutIndex,
+ LayoutPostList,
+ LayoutSearch,
+ LayoutSlug,
+ LayoutTagIndex,
+ CONFIG as THEME_CONFIG
}