diff --git a/themes/example/index.js b/themes/example/index.js index 4abf3756..118a1d75 100644 --- a/themes/example/index.js +++ b/themes/example/index.js @@ -133,9 +133,9 @@ const LayoutPostList = props => { slotTop = props.slotTop } return ( - +
{siteConfig('POST_LIST_STYLE') === 'page' ? : } - +
) } @@ -147,7 +147,7 @@ const LayoutPostList = props => { const LayoutSlug = props => { const { post, lock, validPassword } = props return ( - +
{lock ? :
@@ -156,7 +156,7 @@ const LayoutSlug = props => {
} - +
) } @@ -166,7 +166,7 @@ const LayoutSlug = props => { * @returns */ const Layout404 = (props) => { - return 404 Not found. + return
404 Not found.
} /** @@ -207,13 +207,13 @@ const LayoutSearch = props => { const LayoutArchive = props => { const { archivePosts } = props return ( - +
{Object.keys(archivePosts).map(archiveTitle => ( ))}
- +
) } @@ -225,11 +225,11 @@ const LayoutArchive = props => { const LayoutCategoryIndex = props => { const { categoryOptions } = props return ( - +
{categoryOptions?.map(category => )}
- +
) } @@ -241,16 +241,17 @@ const LayoutCategoryIndex = props => { const LayoutTagIndex = (props) => { const { tagOptions } = props return ( - +
{tagOptions.map(tag => )}
- +
) } export { CONFIG as THEME_CONFIG, + LayoutBase, LayoutIndex, LayoutPostList, LayoutSearch, diff --git a/themes/fukasawa/index.js b/themes/fukasawa/index.js index bf41b1a6..7ce9763f 100644 --- a/themes/fukasawa/index.js +++ b/themes/fukasawa/index.js @@ -126,12 +126,12 @@ const LayoutIndex = (props) => { * @param {*} props */ const LayoutPostList = (props) => { - return + return
{siteConfig('POST_LIST_STYLE') === 'page' ? : } - +
} /** @@ -142,9 +142,9 @@ const LayoutPostList = (props) => { const LayoutSlug = (props) => { const { lock, validPassword } = props return ( - +
{lock ? : } - +
) } @@ -174,7 +174,7 @@ const LayoutSearch = props => { */ const LayoutArchive = (props) => { const { archivePosts } = props - return + return
{Object.keys(archivePosts).map(archiveTitle => ( { /> ))}
- +
} /** @@ -193,7 +193,7 @@ const LayoutArchive = (props) => { * @returns */ const Layout404 = props => { - return 404 + return
404
} /** @@ -205,7 +205,7 @@ const LayoutCategoryIndex = (props) => { const { locale } = useGlobal() const { categoryOptions } = props return ( - +
{locale.COMMON.CATEGORY}: @@ -227,7 +227,7 @@ const LayoutCategoryIndex = (props) => { })}
- +
) } @@ -239,7 +239,7 @@ const LayoutCategoryIndex = (props) => { const LayoutTagIndex = (props) => { const { locale } = useGlobal() const { tagOptions } = props - return + return
{locale.COMMON.TAGS}:
@@ -252,11 +252,12 @@ const LayoutTagIndex = (props) => { })}
- +
} export { CONFIG as THEME_CONFIG, + LayoutBase, LayoutIndex, LayoutSearch, LayoutArchive, diff --git a/themes/gitbook/index.js b/themes/gitbook/index.js index 4743199c..57d652c9 100644 --- a/themes/gitbook/index.js +++ b/themes/gitbook/index.js @@ -193,7 +193,7 @@ const LayoutIndex = (props) => { }) }, []) - return + return
} /** @@ -203,9 +203,9 @@ const LayoutIndex = (props) => { * @returns */ const LayoutPostList = (props) => { - return + return
- +
} /** @@ -217,7 +217,7 @@ const LayoutSlug = (props) => { const { post, prev, next, lock, validPassword } = props return ( - +
{/* 文章锁 */} {lock && } @@ -250,7 +250,7 @@ const LayoutSlug = (props) => {
} -
+
) } @@ -261,7 +261,7 @@ const LayoutSlug = (props) => { * @returns */ const LayoutSearch = (props) => { - return + return
} /** @@ -273,20 +273,20 @@ const LayoutSearch = (props) => { const LayoutArchive = (props) => { const { archivePosts } = props - return + return
{Object.keys(archivePosts)?.map(archiveTitle => )}
- +
} /** * 404 */ const Layout404 = props => { - return + return
404 Not found.
- +
} /** @@ -295,7 +295,7 @@ const Layout404 = props => { const LayoutCategoryIndex = (props) => { const { categoryOptions } = props const { locale } = useGlobal() - return + return
{locale.COMMON.CATEGORY}: @@ -317,7 +317,7 @@ const LayoutCategoryIndex = (props) => { })}
- +
} /** @@ -327,7 +327,7 @@ const LayoutTagIndex = (props) => { const { tagOptions } = props const { locale } = useGlobal() - return + return
@@ -343,11 +343,12 @@ const LayoutTagIndex = (props) => { })}
- +
} export { CONFIG as THEME_CONFIG, + LayoutBase, LayoutIndex, LayoutSearch, LayoutArchive, diff --git a/themes/heo/index.js b/themes/heo/index.js index 30a7eef1..f81fb21d 100644 --- a/themes/heo/index.js +++ b/themes/heo/index.js @@ -50,15 +50,38 @@ import { siteConfig } from '@/lib/config' const LayoutBase = props => { const { children, - headerSlot, slotTop, - slotRight, className, meta } = props // 全屏模式下的最大宽度 const { fullWidth } = useGlobal() + const router = useRouter() + console.log(router) + + const headerSlot = ( +
+ {/* 顶部导航 */} + + {/* 通知横幅 */} + {router.route==='/' ? <> + + + + : null} +
+ +
+ {fullWidth ? null : } +
+ ) + + // 右侧栏 用户信息+标签列表 + const slotRight = fullWidth ? null : + const maxWidth = fullWidth ? 'max-w-[96rem] mx-auto' : 'max-w-[86rem]' // 普通最大宽度是86rem和顶部菜单栏对齐,留空则与窗口对齐 const HEO_HERO_BODY_REVERSE = siteConfig('HEO_HERO_BODY_REVERSE', false, CONFIG) @@ -115,26 +138,7 @@ const LayoutBase = props => { * @returns */ const LayoutIndex = props => { - const headerSlot = ( -
- {/* 顶部导航 */} - - {/* 通知横幅 */} - - -
- -
-
- ) - - // 右侧栏 用户信息+标签列表 - const slotRight = - return ( -
{/* 文章分类条 */} @@ -146,7 +150,6 @@ const LayoutIndex = props => { )}
-
) } @@ -156,19 +159,8 @@ const LayoutIndex = props => { * @returns */ const LayoutPostList = props => { - // 右侧栏 - const slotRight = - const headerSlot = ( -
- {/* 顶部导航 */} - -
- ) return ( -
{/* 文章分类条 */} @@ -180,7 +172,6 @@ const LayoutPostList = props => { )}
-
) } @@ -193,16 +184,7 @@ const LayoutSearch = props => { const { keyword } = props const router = useRouter() const currentSearch = keyword || router?.query?.s - const headerSlot = ( -
- {/* 顶部导航 */} - - -
- ) - + useEffect(() => { // 高亮搜索结果 if (currentSearch) { @@ -219,10 +201,9 @@ const LayoutSearch = props => { } }, []) return ( -
{!currentSearch @@ -241,7 +222,7 @@ const LayoutSearch = props => {
)} -
+ ) } @@ -253,21 +234,9 @@ const LayoutSearch = props => { const LayoutArchive = props => { const { archivePosts } = props - // 右侧栏 - const slotRight = - const headerSlot = ( -
- {/* 顶部导航 */} - -
- ) - // 归档页顶部显示条,如果是默认归档则不显示。分类详情页显示分类列表,标签详情页显示当前标签 return ( -
{/* 文章分类条 */} @@ -282,7 +251,6 @@ const LayoutArchive = props => { ))}
-
) } @@ -302,34 +270,16 @@ const LayoutSlug = props => { setHasCode(hasCode) }, []) - // 右侧栏 - const slotRight = fullWidth ? null : - const headerSlot = ( -
- {/* 顶部导航 */} - - {fullWidth ? null : } -
- ) + const commentEnable = siteConfig('COMMENT_TWIKOO_ENV_ID') || siteConfig('COMMENT_WALINE_SERVER_URL') || siteConfig('COMMENT_VALINE_APP_ID') || siteConfig('COMMENT_GISCUS_REPO') || siteConfig('COMMENT_CUSDIS_APP_ID') || siteConfig('COMMENT_UTTERRANCES_REPO') || siteConfig('COMMENT_GITALK_CLIENT_ID') || siteConfig('COMMENT_WEBMENTION_ENABLE') return ( -
{lock && } @@ -390,7 +340,7 @@ const LayoutSlug = props => { )}
-
+ ) } @@ -477,18 +427,10 @@ const Layout404 = props => { const LayoutCategoryIndex = props => { const { categoryOptions } = props const { locale } = useGlobal() - const headerSlot = ( -
- {/* 顶部导航 */} - -
- ) + return ( - -
+
{locale.COMMON.CATEGORY}
@@ -520,7 +462,6 @@ const LayoutCategoryIndex = props => { })}
-
) } @@ -532,17 +473,9 @@ const LayoutCategoryIndex = props => { const LayoutTagIndex = props => { const { tagOptions } = props const { locale } = useGlobal() - const headerSlot = ( -
- {/* 顶部导航 */} - -
- ) + return ( - -
+
{locale.COMMON.TAGS}
@@ -574,12 +507,12 @@ const LayoutTagIndex = props => { })}
-
) } export { CONFIG as THEME_CONFIG, + LayoutBase, LayoutIndex, LayoutSearch, LayoutArchive, diff --git a/themes/hexo/index.js b/themes/hexo/index.js index fc3dace7..3664a2a7 100644 --- a/themes/hexo/index.js +++ b/themes/hexo/index.js @@ -46,8 +46,11 @@ export const useHexoGlobal = () => useContext(ThemeGlobalHexo) * @constructor */ const LayoutBase = props => { - const { children, headerSlot, floatSlot, slotTop, meta, className } = props + const { children, floatSlot, slotTop, meta, className } = props const { onLoading, fullWidth } = useGlobal() + + const router = useRouter() + const headerSlot = router.route==='/' && siteConfig('HEXO_HOME_BANNER_ENABLE', null, CONFIG) ? : null // Algolia搜索框 const searchModal = useRef(null) @@ -125,8 +128,7 @@ const LayoutBase = props => { * @returns */ const LayoutIndex = (props) => { - const headerSlot = siteConfig('HEXO_HOME_BANNER_ENABLE', null, CONFIG) && - return + return } /** @@ -135,10 +137,10 @@ const LayoutIndex = (props) => { * @returns */ const LayoutPostList = (props) => { - return + return
{siteConfig('POST_LIST_STYLE') === 'page' ? : } - +
} /** @@ -165,11 +167,11 @@ const LayoutSearch = props => { }) return ( - +
{!currentSearch ? :
{siteConfig('POST_LIST_STYLE') === 'page' ? : }
} - +
) } @@ -180,7 +182,7 @@ const LayoutSearch = props => { */ const LayoutArchive = (props) => { const { archivePosts } = props - return + return
{Object.keys(archivePosts).map(archiveTitle => ( @@ -192,7 +194,7 @@ const LayoutArchive = (props) => { ))}
- +
} /** @@ -218,7 +220,7 @@ const LayoutSlug = props => { return ( - } showCategory={false} showTag={false} floatSlot={floatSlot} > +
} showCategory={false} showTag={false} floatSlot={floatSlot} >
{lock && } @@ -253,7 +255,7 @@ const LayoutSlug = props => {
- +
) } @@ -278,7 +280,7 @@ const Layout404 = props => { }, 3000) }) return ( - +

@@ -289,7 +291,7 @@ const Layout404 = props => {

-
+ ) } @@ -302,7 +304,7 @@ const LayoutCategoryIndex = props => { const { categoryOptions } = props const { locale } = useGlobal() return ( - +
{locale.COMMON.CATEGORY}: @@ -319,7 +321,7 @@ const LayoutCategoryIndex = props => { })}
- +
) } @@ -332,7 +334,7 @@ const LayoutTagIndex = props => { const { tagOptions } = props const { locale } = useGlobal() return ( - +
{locale.COMMON.TAGS}: @@ -343,12 +345,13 @@ const LayoutTagIndex = props => {
)}
-
+ ) } export { CONFIG as THEME_CONFIG, + LayoutBase, LayoutIndex, LayoutSearch, LayoutArchive, diff --git a/themes/landing/index.js b/themes/landing/index.js index b7f81495..86ef856d 100644 --- a/themes/landing/index.js +++ b/themes/landing/index.js @@ -57,13 +57,13 @@ const LayoutBase = (props) => { */ const LayoutIndex = (props) => { return ( - +
- +
) } @@ -81,24 +81,25 @@ const LayoutSlug = (props) => { return
} - return + return
- +
} // 其他布局暂时留空 -const LayoutSearch = (props) => -const LayoutArchive = (props) => -const Layout404 = (props) => -const LayoutCategoryIndex = (props) => -const LayoutPostList = (props) => -const LayoutTagIndex = (props) => +const LayoutSearch = (props) =>
+const LayoutArchive = (props) =>
+const Layout404 = (props) =>
+const LayoutCategoryIndex = (props) =>
+const LayoutPostList = (props) =>
+const LayoutTagIndex = (props) =>
export { CONFIG as THEME_CONFIG, + LayoutBase, LayoutIndex, LayoutSearch, LayoutArchive, diff --git a/themes/matery/index.js b/themes/matery/index.js index 6ecb7dbf..cbe23823 100644 --- a/themes/matery/index.js +++ b/themes/matery/index.js @@ -40,9 +40,12 @@ import { siteConfig } from '@/lib/config' * @constructor */ const LayoutBase = props => { - const { children, headerSlot, meta, siteInfo, containerSlot, post } = props + const { children, meta, siteInfo, post } = props const { onLoading, fullWidth } = useGlobal() + const containerSlot= + const headerSlot= siteConfig('MATERY_HOME_BANNER_ENABLE', null, CONFIG) ? : null + return (
{/* SEO相关 */} @@ -113,7 +116,7 @@ const LayoutBase = props => { * @returns */ const LayoutIndex = (props) => { - return } headerSlot={siteConfig('MATERY_HOME_BANNER_ENABLE', null, CONFIG) && } /> + return } /** @@ -123,9 +126,9 @@ const LayoutIndex = (props) => { */ const LayoutPostList = (props) => { return ( - }> +
}> {siteConfig('POST_LIST_STYLE') === 'page' ? : } - +
) } @@ -152,13 +155,13 @@ const LayoutSearch = props => { } }) return ( - +
{!currentSearch ? :
{siteConfig('POST_LIST_STYLE') === 'page' ? : }
} - +
) } @@ -169,7 +172,7 @@ const LayoutSearch = props => { */ const LayoutArchive = (props) => { const { archivePosts } = props - return } > + return
} >
{Object.keys(archivePosts).map(archiveTitle => ( @@ -181,7 +184,7 @@ const LayoutArchive = (props) => { ))}
- +
} /** @@ -194,7 +197,7 @@ const LayoutSlug = props => { const { fullWidth } = useGlobal() const headerSlot = fullWidth ? null : - return (}> + return (
}>
@@ -257,7 +260,7 @@ const LayoutSlug = props => {
- +
) } @@ -280,7 +283,7 @@ const Layout404 = props => { }, 3000) }) return ( - +

@@ -291,7 +294,7 @@ const Layout404 = props => {

-
+
) } @@ -304,7 +307,7 @@ const LayoutCategoryIndex = props => { const { categoryOptions } = props return ( - } > +
} >
@@ -321,7 +324,7 @@ const LayoutCategoryIndex = props => {
-
+ ) } @@ -334,7 +337,7 @@ const LayoutTagIndex = props => { const { tagOptions } = props const { locale } = useGlobal() return ( - } > +
} >
@@ -354,12 +357,13 @@ const LayoutTagIndex = props => {
-
+ ) } export { CONFIG as THEME_CONFIG, + LayoutBase, LayoutIndex, LayoutPostList, LayoutSearch, diff --git a/themes/medium/index.js b/themes/medium/index.js index 433ed80b..cb6bf541 100644 --- a/themes/medium/index.js +++ b/themes/medium/index.js @@ -138,9 +138,9 @@ const LayoutIndex = (props) => { */ const LayoutPostList = (props) => { const slotTop = - return + return
{siteConfig('POST_LIST_STYLE') === 'page' ? : } - +
} /** @@ -158,7 +158,7 @@ const LayoutSlug = props => { ) return ( - +
{/* 文章锁 */} {lock && } @@ -192,7 +192,7 @@ const LayoutSlug = props => { {/* 移动端目录 */}
} -
+ ) } @@ -220,7 +220,7 @@ const LayoutSearch = (props) => { } }, []) - return + return
{/* 搜索导航栏 */}
@@ -236,7 +236,7 @@ const LayoutSearch = (props) => { {currentSearch &&
{siteConfig('POST_LIST_STYLE') === 'page' ? : }
} - +
} /** @@ -247,12 +247,12 @@ const LayoutSearch = (props) => { const LayoutArchive = props => { const { archivePosts } = props return ( - +
{Object.keys(archivePosts)?.map(archiveTitle => )}
- +
) } @@ -262,9 +262,9 @@ const LayoutArchive = props => { * @returns */ const Layout404 = props => { - return + return
404 Not found.
- +
} /** @@ -276,7 +276,7 @@ const LayoutCategoryIndex = (props) => { const { categoryOptions } = props const { locale } = useGlobal() return ( - +
{locale.COMMON.CATEGORY}: @@ -298,7 +298,7 @@ const LayoutCategoryIndex = (props) => { })}
- +
) } @@ -311,7 +311,7 @@ const LayoutTagIndex = props => { const { tagOptions } = props const { locale } = useGlobal() return ( - +
@@ -327,12 +327,13 @@ const LayoutTagIndex = props => { })}
- +
) } export { CONFIG as THEME_CONFIG, + LayoutBase, LayoutIndex, LayoutPostList, LayoutSearch, diff --git a/themes/nav/index.js b/themes/nav/index.js index d4870f12..9c98dab2 100755 --- a/themes/nav/index.js +++ b/themes/nav/index.js @@ -172,10 +172,10 @@ const LayoutPostListIndex = props => { // const { customMenu, children, post, allNavPages, categoryOptions, slotLeft, slotRight, slotTop, meta } = props // const [filteredNavPages, setFilteredNavPages] = useState(allNavPages) return ( - +
- +
) } @@ -189,7 +189,7 @@ const LayoutPostList = props => { // 顶部如果是按照分类或标签查看文章列表,列表顶部嵌入一个横幅 // 如果是搜索,则列表顶部嵌入 搜索框 return ( - +
{posts?.map(post => ( @@ -197,7 +197,7 @@ const LayoutPostList = props => { ))}
- +
) } @@ -210,7 +210,7 @@ const LayoutSlug = (props) => { const { post, lock, validPassword } = props return ( - +
{/* 文章锁 */} {lock && } @@ -244,7 +244,7 @@ const LayoutSlug = (props) => {
} -
+
) } @@ -255,7 +255,7 @@ const LayoutSlug = (props) => { * @returns */ const LayoutSearch = (props) => { - return + return
} /** @@ -267,20 +267,20 @@ const LayoutSearch = (props) => { const LayoutArchive = (props) => { const { archivePosts } = props - return + return
{Object.keys(archivePosts)?.map(archiveTitle => )}
- +
} /** * 404 */ const Layout404 = props => { - return + return
404 Not found.
- +
} /** @@ -289,7 +289,7 @@ const Layout404 = props => { const LayoutCategoryIndex = (props) => { const { categoryOptions } = props const { locale } = useGlobal() - return + return
{locale.COMMON.CATEGORY}: @@ -311,7 +311,7 @@ const LayoutCategoryIndex = (props) => { })}
- +
} /** @@ -321,7 +321,7 @@ const LayoutTagIndex = (props) => { const { tagOptions } = props const { locale } = useGlobal() - return + return
@@ -337,11 +337,12 @@ const LayoutTagIndex = (props) => { })}
- +
} export { CONFIG as THEME_CONFIG, + LayoutBase, LayoutIndex, LayoutSearch, LayoutArchive, diff --git a/themes/nobelium/index.js b/themes/nobelium/index.js index c45bd08d..f5152842 100644 --- a/themes/nobelium/index.js +++ b/themes/nobelium/index.js @@ -130,10 +130,10 @@ const LayoutPostList = props => { } return ( - }> +
}> {topSlot} {siteConfig('POST_LIST_STYLE') === 'page' ? : } - +
) } @@ -171,10 +171,10 @@ const LayoutSearch = props => { filteredBlogPosts = deepClone(posts) } - return }> + return
}> {siteConfig('POST_LIST_STYLE') === 'page' ? : } - +
} /** @@ -185,11 +185,11 @@ const LayoutSearch = props => { const LayoutArchive = props => { const { archivePosts } = props return ( - +
{Object.keys(archivePosts).map(archiveTitle => )}
- +
) } @@ -202,7 +202,7 @@ const LayoutSlug = props => { const { post, lock, validPassword } = props return ( - +
{lock && } @@ -216,7 +216,7 @@ const LayoutSlug = props => {
} -
+ ) } @@ -226,9 +226,9 @@ const LayoutSlug = props => { * @returns */ const Layout404 = (props) => { - return + return
404 Not found. - +
} /** @@ -240,7 +240,7 @@ const LayoutCategoryIndex = (props) => { const { categoryOptions } = props return ( - +
{categoryOptions?.map(category => { return ( @@ -257,7 +257,7 @@ const LayoutCategoryIndex = (props) => { ) })}
- +
) } @@ -269,7 +269,7 @@ const LayoutCategoryIndex = (props) => { const LayoutTagIndex = (props) => { const { tagOptions } = props return ( - +
{tagOptions.map(tag => { @@ -284,12 +284,13 @@ const LayoutTagIndex = (props) => { })}
- +
) } export { CONFIG as THEME_CONFIG, + LayoutBase, LayoutIndex, LayoutSearch, LayoutArchive, diff --git a/themes/plog/index.js b/themes/plog/index.js index 22ec32c6..a777055b 100644 --- a/themes/plog/index.js +++ b/themes/plog/index.js @@ -98,9 +98,9 @@ const LayoutIndex = props => { */ const LayoutPostList = props => { return ( - +
{siteConfig('POST_LIST_STYLE') === 'page' ? : } - +
) } @@ -137,11 +137,11 @@ const LayoutSearch = props => { const LayoutArchive = props => { const { archivePosts } = props return ( - +
{Object.keys(archivePosts).map(archiveTitle => )}
- +
) } @@ -154,7 +154,7 @@ const LayoutSlug = props => { const { post, lock, validPassword } = props return ( - +
{lock && } @@ -168,7 +168,7 @@ const LayoutSlug = props => {
} -
+ ) } @@ -178,9 +178,9 @@ const LayoutSlug = props => { * @returns */ const Layout404 = (props) => { - return + return
404 Not found. - +
} /** @@ -192,7 +192,7 @@ const LayoutCategoryIndex = (props) => { const { categoryOptions } = props return ( - +
{categoryOptions?.map(category => { return ( @@ -209,7 +209,7 @@ const LayoutCategoryIndex = (props) => { ) })}
- +
) } @@ -221,7 +221,7 @@ const LayoutCategoryIndex = (props) => { const LayoutTagIndex = (props) => { const { tagOptions } = props return ( - +
{tagOptions.map(tag => { @@ -236,12 +236,13 @@ const LayoutTagIndex = (props) => { })}
- +
) } export { CONFIG as THEME_CONFIG, + LayoutBase, LayoutIndex, LayoutSearch, LayoutArchive, diff --git a/themes/simple/components/SideBar.js b/themes/simple/components/SideBar.js index 0d17afec..980cccee 100644 --- a/themes/simple/components/SideBar.js +++ b/themes/simple/components/SideBar.js @@ -2,7 +2,6 @@ import { AdSlot } from '@/components/GoogleAdsense' import Live2D from '@/components/Live2D' import Announcement from './Announcement' import Catalog from './Catalog' -import { useEffect } from 'react' /** * 侧边栏 @@ -12,9 +11,6 @@ import { useEffect } from 'react' let counter = 0; export default function SideBar (props) { const { notice } = props - useEffect(()=>{ - console.log('sidebar 渲染次数: ', counter++) -}, []) return (<>